{ "info": { "author": "Patrick Carey", "author_email": "paddy@wackwack.co.uk", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "===============================\nDweepy\n===============================\n\n.. image:: https://img.shields.io/pypi/v/dweepy.svg?style=flat\n :target: https://pypi.python.org/pypi/dweepy/\n :alt: Latest PyPI version\n\n.. image:: https://img.shields.io/pypi/dm/dweepy.svg?style=flat\n :target: https://pypi.python.org/pypi/dweepy/\n :alt: Number of PyPI downloads\n\n.. image:: https://img.shields.io/travis/paddycarey/dweepy/master.png?style=flat\n :target: https://travis-ci.org/paddycarey/dweepy\n :alt: Travis CI build status\n\nDweepy is a simple Python client for `dweet.io `_. Dweepy has a full test suite and aims to have 100% coverage of the `dweet.io `_ API (we're pretty much there already).\n\nLarge portions of this README have been adapted from the README of the the official `javascript client from buglabs `_.\n\nDweepy supports Python 2.6, 2.7, PyPy, 3.3 and 3.4 (and probably later versions too, but I haven't tested on those).\n\n* Free software: MIT license\n* Documentation: https://github.com/paddycarey/dweepy\n\n\n\nInstallation\n------------\n\nDistribute & Pip\n~~~~~~~~~~~~~~~~\n\nInstalling dweepy is simple with `pip `_::\n\n $ pip install dweepy\n\nor, with `easy_install `_::\n\n $ easy_install dweepy\n\nBut, you really `shouldn't do that `_.\n\n\nGet the Code\n~~~~~~~~~~~~\n\nDweepy is actively developed on GitHub, where the code is `always available `_.\n\nYou can either clone the public repository::\n\n $ git clone git://github.com/paddycarey/dweepy.git\n\nOr download the `tarball `_::\n\n $ curl -OL https://github.com/paddycarey/dweepy/tarball/master\n\nOnce you have a copy of the source, you can embed it in your Python package, or install it into your site-packages easily::\n\n $ python setup.py install\n\n\n\nUsage\n-----\n\nDweepy aims to provide a simple, pythonic interface to dweet.io. It has been designed to be easy to use, and aims to cover the dweet.io API entirely.\n\nFirst you'll need to import dweepy.::\n\n import dweepy\n\n\nDweeting\n~~~~~~~~\n\nYou can send a dweet without specify a name for your thing.::\n\n >>> dweepy.dweet({'some_key': 'some_value'})\n {\n u'content': {u'some_key': u'some_value'},\n u'created': u'2014-03-19T10:35:59.504Z',\n u'thing': u'unequaled-start'\n }\n\nNote: If you do not specify a name for your thing, dweet.io will assign a random name and return it in the response as above.\n\nYou can send a dweet from a thing with a specified name.::\n\n >>> dweepy.dweet_for('this_is_a_thing', {'some_key': 'some_value'})\n {\n u'content': {u'some_key': u'some_value'},\n u'created': u'2014-03-19T10:38:46.010Z',\n u'thing': u'this_is_a_thing'\n }\n\n\nGetting Dweets\n~~~~~~~~~~~~~~\n\nTo read the latest dweet for a thing, you can call::\n\n >>> dweepy.get_latest_dweet_for('this_is_a_thing')\n [\n {\n u'content': {u'some_key': u'some_value'},\n u'created': u'2014-03-19T10:38:46.010Z',\n u'thing': u'this_is_a_thing'\n }\n ]\n\n\nNote that dweet.io only holds on to the last 500 dweets over a 24 hour period. If the thing hasn't dweeted in the last 24 hours, its history will be removed.\n\nOr to read all the dweets for a thing, you can call::\n\n >>> dweepy.get_dweets_for('this_is_a_thing')\n [\n {\n u'content': {u'some_key': u'some_value'},\n u'created': u'2014-03-19T10:42:31.316Z',\n u'thing': u'this_is_a_thing'\n },\n {\n u'content': {u'some_key': u'some_value'},\n u'created': u'2014-03-19T10:38:46.010Z',\n u'thing': u'this_is_a_thing'\n }\n ]\n\n\nAlerts\n~~~~~~\n\nSet an alert::\n\n >>> dweepy.set_alert(\n ... 'this_is_a_thing',\n ... ['test@example.com', 'anothertest@example.com'],\n ... \"if(dweet.alertValue > 10) return 'TEST: Greater than 10'; if(dweet.alertValue < 10) return 'TEST: Less than 10';\",\n ... 'this-is-a-key',\n ... )\n {\n u'thing': u'this_is_a_thing',\n u'condition': u\"if(dweet.alertValue > 10) return 'TEST: Greater than 10'; if(dweet.alertValue < 10) return 'TEST: Less than 10';\",\n u'is_demo': False,\n u'recipients': [\n {\n u'type': u'email',\n u'address': u'test@example.com',\n },\n {\n u'type': u'email',\n u'address': u'anothertest@example.com',\n }\n ]\n }\n\n\nGet an alert (with status)::\n\n >>> dweepy.get_alert('this_is_a_thing', 'this-is-a-key')\n {\n u'status': {\n u'message': u'',\n u'since': None,\n u'open': False,\n u'alerts_sent_today': 0,\n u'alerts_allowed_today': 100,\n },\n u'thing': u'this_is_a_thing',\n u'condition': u\"if(dweet.alertValue > 10) return 'TEST: Greater than 10'; if(dweet.alertValue < 10) return 'TEST: Less than 10';\",\n u'is_demo': False,\n u'recipients': [\n {\n u'type': u'email',\n u'address': u'test@example.com'\n },\n {\n u'type': u'email',\n u'address': u'anothertest@example.com'\n }\n ]\n }\n\n\nRemove an alert::\n\n >>> dweepy.remove_alert('this_is_a_thing', 'this-is-a-key')\n {\n u'thing': u'this_is_a_thing'\n }\n\n\nSubscriptions & Notifications\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n\nYou can create a real-time subscription to dweets using a \"chunked\" HTTP response.::\n\n >>> for dweet in dweepy.listen_for_dweets_from('this_is_a_thing'):\n >>> print dweet\n {u'content': {u'some_key': u'some_value'}, u'thing': u'this_is_a_thing', u'created': u'2014-03-19T10:45:28.934Z'}\n {u'content': {u'some_key': u'some_value'}, u'thing': u'this_is_a_thing', u'created': u'2014-03-19T10:45:31.574Z'}\n\nThe server will keep the connection alive and send you dweets as they arrive.\n\n\nLocking & Security\n~~~~~~~~~~~~~~~~~~\n\nBy default, all things are publicly accessible if you know the name of the thing. You can also lock things so that they are only accessible to users with valid security credentials. To purchase locks, visit `https://dweet.io/locks `_. The locks will be emailed to you.\n\n\nTo lock a thing::\n\n >>> dweepy.lock(\"my-thing\", \"my-lock\", \"my-key\")\n\n\nTo unlock a thing::\n\n >>> dweepy.unlock(\"my-thing\", \"my-key\")\n \"my-thing\"\n\n\nTo remove a lock no matter what it's attached to::\n\n >>> dweepy.remove_lock(\"my-lock\", \"my-key\")\n \"my-lock\"\n\n\nOnce a thing has been locked, you must pass the key to the lock with any call you make to other functions in this client library. The key will be passed as an optional keyword argument. For example::\n\n >>> dweepy.dweet_for(\"my-locked-thing\", {\"some\":\"data\"}, \"my-key\")\n >>> dweepy.get_latest_dweet_for(\"my-locked-thing\", \"my-key\")\n >>> dweepy.get_dweets_for(\"my-locked-thing\", \"my-key\")\n >>> dweepy.listen_for_dweets_from(\"my-locked-thing\", \"my-key\")\n\nFailure to pass a key or passing an incorrect key for a locked thing will result in an exception being raised.\n\n\nError Handling\n~~~~~~~~~~~~~~\n\nWhen dweepy encounters an error a ``DweepyError`` exception is raised. This can happen either when a HTTP request to the dweet.io API fails with an invalid status code, or if the HTTP request succeeds but the request fails for some reason (invalid key, malformed request data, invalid action etc.).\n\n\nRequest Sessions\n~~~~~~~~~~~~~~~~\n\nEach API call allows a request ``Session`` to be optionally set to persist certain parameters across dweepy calls. Sessions can be used for:\n\n* reusing the the underlying TCP connection if you're making several requests to the same host\n* configuring HTTP Proxies\n* enabling timeouts for HTTP requests\n\nFurther information of requests session can be found in `Request Session Advanced Usage `_.\n\nTo enable a session (in this case with a 5 second timeout)::\n\n >>> import requests\n >>> session_with_timeout = requests.session(timeout=5.0)\n\n\nThe session may be used in all dweepy API calls::\n\n >>> dweepy.dweet({'some_key': 'some_value'}, session=session_with_timeout)\n >>> dweepy.dweet_for('this_is_a_thing', {'some_key': 'some_value'}, session=session_with_timeout)\n\n\nTesting\n-------\n\nDweepy has a full test suite (a port of `dweetio-client's `_ test suite). Assuming you have a full source checkout of the dweepy repository, running the tests is simple with ``tox``::\n\n $ pip install tox\n $ tox\n\nIt is recommended that you use a virtualenv when developing or running the tests to ensure that system libraries do not interfere with the tests.\n\n**NOTE:** In order for all of the tests to complete successfully you must set several environment variables. There are numerous ways to accomplish this, but I like `forego `_ (a golang port of the `foreman `_ utility).\n\nTo use forego in your tests you should first create a ``.env`` file in the root of your repository with the following contents::\n\n DWEET_LOCK=mylock\n DWEET_KEY=mykey\n\nOnce in place, you can run your tests locally with::\n\n $ forego run tox\n\nIf you want to test against a single python version, you can use ``tox -e`` e.g.::\n\n $ forego run tox -e py27\n $ forego run tox -e pypy\n $ forego run tox -e py34\n\n**TIP:** If you're using Ubuntu, you can find older/newer versions of python than the one shipped with your distribution `here `_. You can install as many as you like side by side without affecting your default python install.\n\n\nCopyright & License\n-------------------\n\n| Copyright (c) 2014 Patrick Carey (https://github.com/paddycarey)\n| Licensed under the **MIT** license.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/paddycarey/dweepy", "keywords": "dweepy dweet dweet.io", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "dweepy", "package_url": "https://pypi.org/project/dweepy/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/dweepy/", "project_urls": { "Homepage": "https://github.com/paddycarey/dweepy" }, "release_url": "https://pypi.org/project/dweepy/0.3.0/", "requires_dist": null, "requires_python": "", "summary": "Dweepy is a Python client for dweet.io", "version": "0.3.0" }, "last_serial": 2866693, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "25848808fe925867637e0bdac368290d", "sha256": "c9ad9f9135b5af05ee9008cebcff2f82f4ad0548ec6751b66e5a7afe9b047072" }, "downloads": -1, "filename": "dweepy-0.0.1.tar.gz", "has_sig": false, "md5_digest": "25848808fe925867637e0bdac368290d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4485, "upload_time": "2014-03-19T10:58:18", "url": "https://files.pythonhosted.org/packages/9a/c5/a6f8fa6ea8d1c927ac89e89912865c20f7ba5202dc218632612251307158/dweepy-0.0.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "5ad51670567eec55f578fdc2583e93db", "sha256": "a89730cb2e924cb4cd9bafb605874baf6f709cd42ce141407cda6e0f8815e5f3" }, "downloads": -1, "filename": "dweepy-0.2.0.tar.gz", "has_sig": false, "md5_digest": "5ad51670567eec55f578fdc2583e93db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6763, "upload_time": "2014-11-11T22:06:03", "url": "https://files.pythonhosted.org/packages/e7/48/f6a10cf276f94f2b6fbc0665dfe7a855774511eaa3c4ea85c57ace9d933a/dweepy-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "5fff6fd687a0954f86af1876a96e814c", "sha256": "5d5c2b9071ad1e1069ec5d144ac7f47bc632062a6a8effb725142c7576a68f6b" }, "downloads": -1, "filename": "dweepy-0.3.0.tar.gz", "has_sig": false, "md5_digest": "5fff6fd687a0954f86af1876a96e814c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8080, "upload_time": "2017-05-11T10:51:23", "url": "https://files.pythonhosted.org/packages/1b/da/a810d2a0fb08d7bf715363538a380072a5158ac40b2084992633ba2b85d9/dweepy-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5fff6fd687a0954f86af1876a96e814c", "sha256": "5d5c2b9071ad1e1069ec5d144ac7f47bc632062a6a8effb725142c7576a68f6b" }, "downloads": -1, "filename": "dweepy-0.3.0.tar.gz", "has_sig": false, "md5_digest": "5fff6fd687a0954f86af1876a96e814c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8080, "upload_time": "2017-05-11T10:51:23", "url": "https://files.pythonhosted.org/packages/1b/da/a810d2a0fb08d7bf715363538a380072a5158ac40b2084992633ba2b85d9/dweepy-0.3.0.tar.gz" } ] }