{ "info": { "author": "Adam Mills", "author_email": "adam@armills.info", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "===============================\naioautomatic\n===============================\n\n\n.. image:: https://img.shields.io/pypi/v/aioautomatic.svg\n :target: https://pypi.python.org/pypi/aioautomatic\n\n.. image:: https://img.shields.io/travis/armills/aioautomatic.svg\n :target: https://travis-ci.org/armills/aioautomatic\n\n.. image:: https://img.shields.io/coveralls/armills/aioautomatic.svg\n :target: https://coveralls.io/r/armills/aioautomatic?branch=master\n\nAsyncio library for the Automatic API\n\n\n* Free software: Apache Software License 2.0\n\nAll methods are python wrappers of the API definitions defined by `Automatic `_.\n\n\nUsage\n-----\n\nIt is recommended to manage the aiohttp ClientSession object externally and pass it to the Client constructor. `(See the aiohttp documentation.) `_ If not passed to Server, a ClientSession object will be created automatically.\n\nQuery for information from the users account.\n\n.. code-block:: python\n\n import asyncio\n import aioautomatic\n import aiohttp\n from datetime import datetime\n from datetime import timedelta\n\n CLIENT_ID = ''\n SECRET_ID = ''\n SCOPE = ['current_location', 'location', 'vehicle:profile', 'user:profile', 'trip']\n\n\n @asyncio.coroutine\n def loop():\n aiohttp_session = aiohttp.ClientSession()\n try:\n client = aioautomatic.Client(\n CLIENT_ID,\n SECRET_ID,\n aiohttp_session)\n url = client.generate_oauth_url(SCOPE)\n\n # Redirect the user to this URL. After the user authorizes access\n # to their account, Automatic will redirect them to your\n # application's OAuth Redirect URL, configured in the Automatic\n # Developer Apps Manager. Capture the code and state returned\n # with that request.\n code = ''\n state = ''\n\n session = yield from client.create_session_from_oauth_code(\n code, state)\n\n # Fetch information about the authorized user\n user = yield from session.get_user()\n user_profile = yield from user.get_profile()\n user_metadata = yield from user.get_metadata()\n print(\"***USER***\")\n print(user)\n print(user.email)\n print(user.first_name)\n print(user.last_name)\n print(user_profile.date_joined)\n print(user_metadata.firmware_version)\n print(user_metadata.device_type)\n print(user_metadata.phone_platform)\n\n # Fetch all devices associated with the user account\n devices = yield from session.get_devices()\n print(\"***DEVICES***\")\n print(devices)\n\n # Fetch a list of vehicles associated with the user account\n vehicles = yield from session.get_vehicles()\n print(\"***VEHICLES***\")\n print(vehicles)\n print(vehicles[0].make)\n print(vehicles[0].model)\n print(vehicles[0].fuel_level_percent)\n\n # Fetch a list of all trips in the last 10 days\n min_end_time = datetime.utcnow() - timedelta(days=10)\n trips = yield from session.get_trips(ended_at__gte=min_end_time, limit=10)\n print(\"***TRIPS***\")\n print(trips)\n print(trips[0].start_location.lat)\n print(trips[0].start_location.lon)\n print(trips[0].start_address.name)\n print(trips[0].distance_m)\n print(trips[0].duration_s)\n\n # If more than 10 trips exist, get the next page of results\n if trips.next is not None:\n trips = yield from trips.get_next()\n print(trips)\n\n # Save the refresh token from the session for use next time\n # a session needs to be created.\n refresh_token = session.refresh_token\n\n # Create a new session with the refresh token.\n session = yield from client.create_session_from_refresh_token(\n refresh_token)\n\n finally:\n yield from aiohttp_session.close()\n\n asyncio.get_event_loop().run_until_complete(loop())\n\nOpen a websocket connection for realtime updates\n\n.. code-block:: python\n\n import asyncio\n import aioautomatic\n import aiohttp\n\n SCOPE = ['current_location', 'location', 'vehicle:profile', 'user:profile', 'trip']\n\n CLIENT_ID = ''\n SECRET_ID = ''\n\n\n def error_callback(name, message):\n print(message)\n\n\n def event_callback(name, data):\n print(name)\n if data.location:\n print(data.location.lat)\n print(data.location.lon)\n\n\n def speeding_callback(name, data):\n print(\"Speeding! Velocity: {:1.2f} KPH\".format(data.velocity_kph))\n\n\n @asyncio.coroutine\n def loop():\n aiohttp_session = aiohttp.ClientSession()\n try:\n client = aioautomatic.Client(\n CLIENT_ID,\n SECRET_ID,\n aiohttp_session)\n\n client.on('closed', closed_callback)\n client.on('notification:speeding', speeding_callback)\n client.on_app_event(callback)\n future = yield from client.ws_connect()\n\n # Run until websocket is closed\n yield from future\n\n finally:\n yield from aiohttp_session.close()\n\n asyncio.get_event_loop().run_until_complete(loop())\n\nChangelog\n---------\n0.6.5 (February 17, 2018)\n~~~~~~~~~~~~~~\n- Validation schemas are now compatible with voluptuous 0.11.\n\n0.6.4 (October 22, 2017)\n~~~~~~~~~~~~~~\n- Vehicle requets now correctly return a location object for latest_location.\n\n0.6.3 (September 14, 2017)\n~~~~~~~~~~~~~~\n- Trip responses that don't include start or end addresses are now accepted.\n\n0.6.2 (August 26, 2017)\n~~~~~~~~~~~~~~\n- Invalid messages received during the websocket loop will only emit a log error instead of bubbling out of the loop.\n\n0.6.1 (August 26, 2017)\n~~~~~~~~~~~~~~\n- Voluptuous errors will no longer bubble out of aioautomatic. Instead InvalidMessageError will be raised.\n\n0.6.0 (August 15, 2017)\n~~~~~~~~~~~~~~\n- Removed `Client.create_session_from_password`, which is no longer supported by Automatic.\n\n0.5.0 (August 12, 2017)\n~~~~~~~~~~~~~~\n- Added `Client.generate_oauth_url` to simplify implementation of OAuth2 authentication.\n- State is now required for `Client.create_session_from_oauth_code`.\n\nCredits\n---------\n\nThis package is built on aiohttp_, which provides the foundation for async HTTP and websocket calls.\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n.. _aiohttp: http://aiohttp.readthedocs.io/en/stable/\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/armills/aioautomatic", "keywords": "aioautomatic", "license": "Apache Software License 2.0", "maintainer": "", "maintainer_email": "", "name": "aioautomatic", "package_url": "https://pypi.org/project/aioautomatic/", "platform": "", "project_url": "https://pypi.org/project/aioautomatic/", "project_urls": { "Homepage": "https://github.com/armills/aioautomatic" }, "release_url": "https://pypi.org/project/aioautomatic/0.6.5/", "requires_dist": null, "requires_python": "", "summary": "Asyncio library for the Automatic API", "version": "0.6.5" }, "last_serial": 3591223, "releases": { "0.1.0": [], "0.1.1": [ { "comment_text": "", "digests": { "md5": "c326c5fab1746720df88c082b4d3cda8", "sha256": "500778c9ca159008016b36240d9f987bfa137f080abaa91849181b258a05a57d" }, "downloads": -1, "filename": "aioautomatic-0.1.1.tar.gz", "has_sig": false, "md5_digest": "c326c5fab1746720df88c082b4d3cda8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13950, "upload_time": "2017-04-15T21:44:46", "url": "https://files.pythonhosted.org/packages/36/38/b40c023fb49ae3a934765ebd6944745c138bb1de2e1f0251ca4139211d11/aioautomatic-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "12e9d99927066c4a28976cc0328007b9", "sha256": "693148070b29a940074e51648175b63564b5e1abc3f49c2799721a45284b1c89" }, "downloads": -1, "filename": "aioautomatic-0.2.0.tar.gz", "has_sig": false, "md5_digest": "12e9d99927066c4a28976cc0328007b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15221, "upload_time": "2017-04-20T00:23:31", "url": "https://files.pythonhosted.org/packages/26/0a/6a626b5e451459435544695ef7ba4923d3693ca373801a1dfeefc40f28bd/aioautomatic-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "dc4b6b22e83f1fc32839f90bc716a5c0", "sha256": "8f050054ef83466b729ea91c35593c2a7a146d47c647cd2f1dd8c0754d9ef606" }, "downloads": -1, "filename": "aioautomatic-0.2.1.tar.gz", "has_sig": false, "md5_digest": "dc4b6b22e83f1fc32839f90bc716a5c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15262, "upload_time": "2017-04-27T11:38:27", "url": "https://files.pythonhosted.org/packages/0a/ee/6b57d28611e9aa28a18f883403cc9ff4b77e289e7cb2b56c184b80f275d1/aioautomatic-0.2.1.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "88b9a6bec87dcbbef91dacb7e1cfa72f", "sha256": "21f6ab84d13b8d40935c3134403c59f3565c8a37ffda75e41fbdb7c42bb58db1" }, "downloads": -1, "filename": "aioautomatic-0.3.0.tar.gz", "has_sig": false, "md5_digest": "88b9a6bec87dcbbef91dacb7e1cfa72f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23575, "upload_time": "2017-05-02T17:25:34", "url": "https://files.pythonhosted.org/packages/a0/f4/c3fc093d7073ef09753c43dfaa0428ddc69de61f1f117d7c0ded167b875f/aioautomatic-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "ac90058aaccbb51cfdc50092e7717dcd", "sha256": "53a3025eff7ac961ee08ae05404d90fd5d559f7ab42dd4e01294d8f4f2126168" }, "downloads": -1, "filename": "aioautomatic-0.3.1.tar.gz", "has_sig": false, "md5_digest": "ac90058aaccbb51cfdc50092e7717dcd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23606, "upload_time": "2017-05-02T20:13:40", "url": "https://files.pythonhosted.org/packages/20/aa/1c4b0f724b55cf84a396b04a7fcc041fb38f2d3686131b9004bf90f40a1b/aioautomatic-0.3.1.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "475d3a9d6f0d9a636ff2b2976a3a1f9d", "sha256": "2b356ad4d5eda86fcbe3d6618c22cd62ada9de139e7a3f617839ab8ad91ac120" }, "downloads": -1, "filename": "aioautomatic-0.4.0.tar.gz", "has_sig": false, "md5_digest": "475d3a9d6f0d9a636ff2b2976a3a1f9d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24555, "upload_time": "2017-05-11T19:38:57", "url": "https://files.pythonhosted.org/packages/31/67/5b8135f700b27a7c87b30f8ccf7be2c65e96cbfe40905ee706dc033965f4/aioautomatic-0.4.0.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "bc4d02d8677de5b33dea6b8ccfe7e520", "sha256": "2591aa46f3d70e2501fefcd4e3535186d262931f9a581c117dbd6e2cfab012b7" }, "downloads": -1, "filename": "aioautomatic-0.5.0.tar.gz", "has_sig": false, "md5_digest": "bc4d02d8677de5b33dea6b8ccfe7e520", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25977, "upload_time": "2017-08-12T17:40:39", "url": "https://files.pythonhosted.org/packages/93/ac/66af7dd949b45bafd34fdab1832cc5dc83279c141efec8047c7987fa7f10/aioautomatic-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "ca686d773293cf18ab4b0b4da394841a", "sha256": "103b30fdf52b6b4486f02dbe46dc83b86d97040669e6c21fc7e6925e33267a42" }, "downloads": -1, "filename": "aioautomatic-0.6.0.tar.gz", "has_sig": false, "md5_digest": "ca686d773293cf18ab4b0b4da394841a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25632, "upload_time": "2017-08-16T00:21:42", "url": "https://files.pythonhosted.org/packages/a1/d9/6d05c21df56df9d933f0b108fdfa010d5573c492c1b3832dffc51ce075df/aioautomatic-0.6.0.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "c4a4a63c5410dc711d975fb7e83817a9", "sha256": "1c9bbc94cdb18e9e2fc77edc765f11d285938e475094fd2f3081f8d32f378e7c" }, "downloads": -1, "filename": "aioautomatic-0.6.1.tar.gz", "has_sig": false, "md5_digest": "c4a4a63c5410dc711d975fb7e83817a9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26046, "upload_time": "2017-08-26T20:27:41", "url": "https://files.pythonhosted.org/packages/17/e3/fbd06754d1ead1cef59f8d5ec9408f340c2bda5c38241f68fbfb596b1c4e/aioautomatic-0.6.1.tar.gz" } ], "0.6.2": [ { "comment_text": "", "digests": { "md5": "ace26062849dd22912963204a2da9ba6", "sha256": "ecaac69b17c0fbf6b0b982406b7c5aacefae239db3d0023bf9b9a67a42c3cea5" }, "downloads": -1, "filename": "aioautomatic-0.6.2.tar.gz", "has_sig": false, "md5_digest": "ace26062849dd22912963204a2da9ba6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26084, "upload_time": "2017-08-26T20:45:05", "url": "https://files.pythonhosted.org/packages/e8/6f/3fbd9f1880c6b5b3264d4b8fe70ce7c7486f68bc9dd2d33a8a320b9cb558/aioautomatic-0.6.2.tar.gz" } ], "0.6.3": [ { "comment_text": "", "digests": { "md5": "b2adae637e2c47db5a8cc5d5a8e8a9eb", "sha256": "b6b0832ffa86f9a8251dbfd313436ba88a81c7d7d8bbd59f68ea7b46a77d0e4a" }, "downloads": -1, "filename": "aioautomatic-0.6.3.tar.gz", "has_sig": false, "md5_digest": "b2adae637e2c47db5a8cc5d5a8e8a9eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26442, "upload_time": "2017-09-15T00:21:44", "url": "https://files.pythonhosted.org/packages/65/c2/71e5152e8f82163d9335c462c73ea88318b96c47a26e0be7c4b4b3334f53/aioautomatic-0.6.3.tar.gz" } ], "0.6.4": [ { "comment_text": "", "digests": { "md5": "d48c549413d9851f61a447b015df1f6b", "sha256": "bd9bb8ad76204a1f0a13e276e988b71bdc0633f92370fcff9ff08ae801c15215" }, "downloads": -1, "filename": "aioautomatic-0.6.4.tar.gz", "has_sig": false, "md5_digest": "d48c549413d9851f61a447b015df1f6b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26632, "upload_time": "2017-10-22T18:25:25", "url": "https://files.pythonhosted.org/packages/80/14/ccbdf19ad4b3ea2837cc46d5cd6a87af6325f27c2ae58ec0af893f890a2d/aioautomatic-0.6.4.tar.gz" } ], "0.6.5": [ { "comment_text": "", "digests": { "md5": "6f7f9c18ffac2c016804ab54616162c5", "sha256": "8e6de1116243554c79b37d9864db4dd5e958097ab497131fc07d98ef3b555169" }, "downloads": -1, "filename": "aioautomatic-0.6.5.tar.gz", "has_sig": false, "md5_digest": "6f7f9c18ffac2c016804ab54616162c5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26816, "upload_time": "2018-02-17T17:02:09", "url": "https://files.pythonhosted.org/packages/7f/3a/3f83b9e599221bff842ab034b47d7024b1f67818e050314d898fb9e22525/aioautomatic-0.6.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6f7f9c18ffac2c016804ab54616162c5", "sha256": "8e6de1116243554c79b37d9864db4dd5e958097ab497131fc07d98ef3b555169" }, "downloads": -1, "filename": "aioautomatic-0.6.5.tar.gz", "has_sig": false, "md5_digest": "6f7f9c18ffac2c016804ab54616162c5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26816, "upload_time": "2018-02-17T17:02:09", "url": "https://files.pythonhosted.org/packages/7f/3a/3f83b9e599221bff842ab034b47d7024b1f67818e050314d898fb9e22525/aioautomatic-0.6.5.tar.gz" } ] }