{ "info": { "author": "Adam Lowry", "author_email": "adam@urbanairship.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Topic :: Software Development :: Libraries" ], "description": "About\n=====\n\n``uaconnect`` is a Python library for using the `Urban Airship Connect\n`_ API for streaming mobile\nevent data to your application.\n\nRequirements\n============\n\nTested on Python 2.7 and 3.5, and should work with 3.3+.\n\nFor tests, ``uaconnect`` also needs `Mock `_.\n\nRunning Tests\n=============\n\nTo run tests, run:\n\n $ python -m unittest discover\n\nUsage\n=====\n\nSee the `Connect Getting Started Guide\n`_, as\nwell as the `Connect API\n`_ for more\ndetails.\n\nBasic usage\n-----------\n\nTo use the library, instantiate a ``Consumer`` object with the application key,\naccess token, and an offset recorder. You can then open the connection, and\nstart reading events.\n\n >>> import uaconnect\n >>> consumer = uaconnect.Consumer(\n ... 'application_key', 'access_token',\n ... uaconnect.FileRecorder('.offset'))\n >>> consumer.connect()\n >>> for event in consumer.read():\n ... if event is None:\n ... continue\n >>> print(\"Got event: {}\".format(event))\n >>> consumer.ack(event)\n\n\nOffset recorders\n----------------\n\nOffset recorders inherit from the abstract base class ``uaconnect.Recorder``,\nimplementing ``read_offset`` and ``write_offset`` methods. One recorder is included\nin the library, ``FileRecorder``, which stores the offest on disk. In the\n``uaconnect.ext.redisrecorder`` package there is an example implementation of\nusing an Redis instance to store the offset.\n\n`ack` calls should be placed depending on whether in a failure scenario your\napp wishes to possibly replay an already handled event, or risk dropping one.\nFor the latter, call ``ack`` as soon as the event is read; for the former, call\n``ack`` only after the event has been fully handled.\n\nAdvanced options when connecting\n================================\n\nUrban Airship Connect supports a variety of `options when connecting\n`_ to make sure\nthat you're only consuming the data that you want. ``uaconnect`` makes it easy\nto use these connection parameters and filters.\n\nSpecifying offsets\n------------------\n\nOne of the advantages of Urban Airship Connect is that you can resume from a\nspecific place in the Connect stream. This is done by specifying the ``offset``\nthat's associated with the event. While ``uaconnect`` automatically tracks\noffsets for you with ``uaconnect.FileRecorder``, you can also explicitly set an\noffset.\n\n >>> import uaconnect\n >>> recorder = uaconnect.FileRecorder(\".offset\") # or wherever you would like the file to exist\n >>> recorder.write_offset(\"8865499359\") # a randomly chosen offset\n >>> recorder.read_offset()\n '8865499359'\n\nAn alternative here is to just write the offset explicitly into the file, or\nwhatever ``Recorder`` subclass you're using to track offsets.\n\n $ cat .offset\n 886549935\n\nNow, the next time you connect, it will pick up from that last offset.\n\nUsing filters\n-------------\n\nFilters are a powerful way of filtering what specific information you'd like to\nsee from the Connect stream. You can filter by event type, device type, latency\non an event, or even specific devices or notifications.\n\nFor a complete list of filters, and their descriptions, check out `the\ndocumentation `_.\n\nHere's a brief example on how to use filters with ``uaconnect``:\n\n >>> import uaconnect\n >>> consumer = uaconnect.Consumer(\n ... 'application_key', 'access_token',\n ... uaconnect.FileRecorder('.offset'))\n >>> f = uaconnect.Filter()\n >>> f.types(\"PUSH_BODY\", \"SEND\") # only receive PUSH_BODY and SEND events.\n >>> consumer.add_filter(f)\n >>> consumer.connect()", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://urbanairship.com/", "keywords": null, "license": "Apache v2", "maintainer": null, "maintainer_email": null, "name": "uaconnect", "package_url": "https://pypi.org/project/uaconnect/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/uaconnect/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://urbanairship.com/" }, "release_url": "https://pypi.org/project/uaconnect/0.2/", "requires_dist": null, "requires_python": null, "summary": "Python package for using Urban Airship Connect", "version": "0.2" }, "last_serial": 4079828, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "597abe46365f9d38b73a1ff0fbdb7a35", "sha256": "8b6e0386593e3415d5d69d2ae93c009b34b11101945ce3f5cb34bd4ef3bfcea7" }, "downloads": -1, "filename": "uaconnect-0.1.tar.gz", "has_sig": false, "md5_digest": "597abe46365f9d38b73a1ff0fbdb7a35", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6102, "upload_time": "2015-11-16T19:45:30", "url": "https://files.pythonhosted.org/packages/3a/fe/a8a152170ed543c3f01b0b2e2f1c33537ae88273dcea3335f9c5763e3a0a/uaconnect-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "2937fbba91d51b48e04dc116ed876492", "sha256": "20b3c60160ac374e935c18f6290e6e4e489f3557f83ee37d0b5f66b9ecc5e6b4" }, "downloads": -1, "filename": "uaconnect-0.2.tar.gz", "has_sig": false, "md5_digest": "2937fbba91d51b48e04dc116ed876492", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7501, "upload_time": "2016-08-01T21:48:49", "url": "https://files.pythonhosted.org/packages/9e/a4/d00936a90cb7db80dd0f0c141b4a0cd36ddf1a5c2886d57d4114260841a1/uaconnect-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2937fbba91d51b48e04dc116ed876492", "sha256": "20b3c60160ac374e935c18f6290e6e4e489f3557f83ee37d0b5f66b9ecc5e6b4" }, "downloads": -1, "filename": "uaconnect-0.2.tar.gz", "has_sig": false, "md5_digest": "2937fbba91d51b48e04dc116ed876492", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7501, "upload_time": "2016-08-01T21:48:49", "url": "https://files.pythonhosted.org/packages/9e/a4/d00936a90cb7db80dd0f0c141b4a0cd36ddf1a5c2886d57d4114260841a1/uaconnect-0.2.tar.gz" } ] }