{ "info": { "author": "DataArt (http://dataart.com)", "author_email": "info@devicehive.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "License :: OSI Approved :: Apache Software License", "Operating System :: MacOS", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Home Automation", "Topic :: Internet", "Topic :: Software Development :: Embedded Systems" ], "description": "|License| |PyPI| |Build Status|\n\nDevicehive plugin\n=================\n\nThis library provides wrapper for DeviceHive plugin API\n\nInstallation\n------------\n\nTo install this package run:\n\n.. code:: bash\n\n pip install devicehive-plugin\n\nCreating a client using Plugin class\n------------------------------------\n\nFirst of all you need to create custom ``Handler`` class.\n\n``Handler`` class provides several ``handle_*`` methods: \\*\n``handle_connect(self)`` will be called after successful connection \\*\n``handle_event(self, event)`` will be called after event of any type is\nreceived. Takes `ApiEvent <#apievent-object>`__ object. \\*\n``handle_command_insert(self, command)`` will be called after\n``command/insert`` event is received. Takes\n`Command <#command-object>`__ object. \\*\n``handle_command_update(self, command)`` will be called after\n``command/update`` event is received. Takes\n`Command <#command-object>`__ object. \\*\n``handle_notification(self, notification)`` will be called after\n``notification/insert`` event is received. Takes\n`Notification <#notification-object>`__ object.\n\n``handle_event`` will be called before type-special ``handle`` methods.\n\nExample:\n\n.. code:: python\n\n from devicehive_plugin import Handler\n\n\n class SimpleHandler(Handler):\n\n def handle_connect(self):\n print('Successfully connected')\n\n def handle_event(self, event):\n print(event.action)\n print(type(event.data))\n\n def handle_command_insert(self, command):\n print(command.command)\n\n def handle_command_update(self, command):\n print(command.command)\n\n def handle_notification(self, notification):\n print(notification.notification)\n\nThe second step is to use ``Plugin`` class for creating connection to\nthe server.\n\nExample:\n\n.. code:: python\n\n from devicehive_plugin import Handler\n from devicehive_plugin import Plugin\n\n\n class SimpleHandler(Handler):\n\n def handle_connect(self):\n print('Successfully connected')\n\n def handle_event(self, event):\n print(event.action)\n print(type(event.data))\n\n def handle_command_insert(self, command):\n print(command.command)\n\n def handle_command_update(self, command):\n print(command.command)\n\n def handle_notification(self, notification):\n print(notification.notification)\n\n\n url = 'ws://playground-dev.devicehive.com/plugin/proxy/'\n topic_name = 'PLUGIN_TOPIC_NAME'\n plugin_access_token = 'PLUGIN_ACCESS_TOKEN'\n plugin = Plugin(SimpleHandler)\n plugin.connect(url, topic_name, plugin_access_token=plugin_access_token)\n\nCustom handler args\n~~~~~~~~~~~~~~~~~~~\n\nIf you need to initialize your handler you can do it the next way:\n\n.. code:: python\n\n from devicehive_plugin import Handler\n from devicehive_plugin import Plugin\n\n\n class SimpleHandler(Handler):\n\n def __init__(self, api, some_arg, some_kwarg):\n super(SimpleHandler, self).__init__(api)\n self._some_arg = some_arg\n self._some_kwarg = some_kwarg\n\n\n plugin = Plugin(SimpleHandler, 'some_arg', some_kwarg='some_kwarg')\n\nAuthentication\n~~~~~~~~~~~~~~\n\nThere are several ways of initial authentication:\n\n- Using plugin's access token\n- Using plugin's refresh token\n- Using user's access token\n- Using user's refresh token\n- Using user's login and password\n\nIf you want to use anything but plugin's access token you need to\nprovide ``auth_url`` parameter.\n\nExamples:\n\n.. code:: python\n\n url = 'ws://playground-dev.devicehive.com/plugin/proxy/'\n topic_name = 'PLUGIN_TOPIC_NAME'\n plugin.connect(url, topic_name,\n plugin_access_token='SOME_PLUGIN_ACCESS_TOKEN')\n\n.. code:: python\n\n url = 'ws://playground-dev.devicehive.com/plugin/proxy/'\n topic_name = 'PLUGIN_TOPIC_NAME'\n auth_url = 'http://playground-dev.devicehive.com/api/rest'\n plugin.connect(url, topic_name, auth_url=auth_url,\n plugin_refresh_token='SOME_PLUGIN_REFRESH_TOKEN')\n\n.. code:: python\n\n url = 'ws://playground-dev.devicehive.com/plugin/proxy/'\n topic_name = 'PLUGIN_TOPIC_NAME'\n auth_url = 'http://playground-dev.devicehive.com/api/rest'\n plugin.connect(url, topic_name, auth_url=auth_url,\n access_token='SOME_USER_ACCESS_TOKEN')\n\n.. code:: python\n\n url = 'ws://playground-dev.devicehive.com/plugin/proxy/'\n topic_name = 'PLUGIN_TOPIC_NAME'\n auth_url = 'http://playground-dev.devicehive.com/api/rest'\n plugin.connect(url, topic_name, auth_url=auth_url,\n refresh_token='SOME_USER_REFRESH_TOKEN')\n\n.. code:: python\n\n url = 'ws://playground-dev.devicehive.com/plugin/proxy/'\n topic_name = 'PLUGIN_TOPIC_NAME'\n auth_url = 'http://playground-dev.devicehive.com/api/rest'\n plugin.connect(url, topic_name, auth_url=auth_url,\n login='SOME_USER_LOGIN', password='SOME_USER_PASSWORD')\n\nApi reference\n-------------\n\nApiEvent object\n~~~~~~~~~~~~~~~\n\nProperties (read only):\n\n- ``is_command_insert_event``\n- ``is_command_update_event``\n- ``is_command_event``\n- ``is_notification_event``\n- ``action``\n- ``raw_data``\n- ``data``\n\nCommand object\n~~~~~~~~~~~~~~\n\nProperties (read only):\n\n- ``id``\n- ``user_id``\n- ``command``\n- ``parameters``\n- ``lifetime``\n- ``timestamp``\n- ``last_updated``\n- ``status``\n- ``result``\n\nNotification object\n~~~~~~~~~~~~~~~~~~~\n\nProperties (read only):\n\n- ``device_id``\n- ``id``\n- ``notification``\n- ``parameters``\n- ``timestamp``\n\nDocker tests\n------------\n\nBuild image\n~~~~~~~~~~~\n\n::\n\n docker build -f Dockerfile -t devicehive-plugin-tests .\n\nRun tests\n~~~~~~~~~\n\nYou can run tests with refresh\\_token by setting ``ADMIN_REFRESH_TOKEN``\nand/or ``CLIENT_REFRESH_TOKEN`` variable:\n\n::\n\n docker run -it -e ADMIN_REFRESH_TOKEN='SOME_ADMIN_REFRESH_TOKEN' devicehive-plugin-tests\n\nOr with access\\_token by setting ``ADMIN_ACCESS_TOKEN`` and/or\n``CLIENT_ACCESS_TOKEN`` variable:\n\n::\n\n docker run -it -e ADMIN_ACCESS_TOKEN='SOME_ADMIN_ACCESS_TOKEN' devicehive-plugin-tests\n\nOr with user login and password by setting ``ADMIN_LOGIN`` and\n``ADMIN_PASSWORD`` for admin account and/or ``CLIENT_LOGIN`` and\n``CLIENT_PASSWORD`` for client account.\n\n::\n\n docker run -it -e ADMIN_LOGIN='SOME_ADMIN_LOGIN' -e ADMIN_PASSWORD='SOME_ADMIN_PASSWORD' devicehive-plugin-tests\n\nTo run tests with enabled requests logging you need to change\n``LOG_LEVEL`` variable:\n\n::\n\n docker run -it -e ADMIN_REFRESH_TOKEN='SOME_ADMIN_REFRESH_TOKEN' -e LOG_LEVEL='DEBUG' devicehive-plugin-tests\n\nTo run the specific test you need to set ``TEST`` variable:\n\n::\n\n docker run -it -e TEST=test_api.py::test_get_info -e ADMIN_REFRESH_TOKEN='SOME_ADMIN_REFRESH_TOKEN' devicehive-plugin-tests\n\n.. |License| image:: https://img.shields.io/badge/License-Apache%202.0-blue.svg\n :target: LICENSE\n.. |PyPI| image:: https://img.shields.io/pypi/v/devicehive-plugin.svg\n :target: https://pypi.python.org/pypi/devicehive-plugin\n.. |Build Status| image:: https://travis-ci.org/devicehive/devicehive-plugin-python.svg?branch=master\n :target: https://travis-ci.org/devicehive/devicehive-plugin-python", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://devicehive.com", "keywords": "iot cloud m2m gateway embedded devicehive plugin", "license": "Apache License 2.0", "maintainer": "", "maintainer_email": "", "name": "devicehive-plugin", "package_url": "https://pypi.org/project/devicehive-plugin/", "platform": "", "project_url": "https://pypi.org/project/devicehive-plugin/", "project_urls": { "Homepage": "https://devicehive.com" }, "release_url": "https://pypi.org/project/devicehive-plugin/1.0.3/", "requires_dist": null, "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "summary": "DeviceHive Python plugin connectivity library", "version": "1.0.3" }, "last_serial": 3752253, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "a746c554dd3f1b507c557548b937cd27", "sha256": "9ac380570fc17e4043b2730f41eca2453bfdf8d2945efbf7462d11b01e613804" }, "downloads": -1, "filename": "devicehive_plugin-1.0.1.tar.gz", "has_sig": false, "md5_digest": "a746c554dd3f1b507c557548b937cd27", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 11598, "upload_time": "2018-03-07T12:55:56", "url": "https://files.pythonhosted.org/packages/0b/71/12223580aecec1db7bc5e6510482727385b7cbfb080426cf3b568de00ce5/devicehive_plugin-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "3444be40afff8ab3b32cb58b9f812fc4", "sha256": "7970268d43cd53be871c86d1f543770218bd250fe9ef3c11dd43e0a90cf238b9" }, "downloads": -1, "filename": "devicehive_plugin-1.0.2.tar.gz", "has_sig": false, "md5_digest": "3444be40afff8ab3b32cb58b9f812fc4", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 15374, "upload_time": "2018-03-12T17:17:06", "url": "https://files.pythonhosted.org/packages/ab/04/cdcb8763d7d3d5ac8cd31f7623a38d069ce05348d78075a1a52902103335/devicehive_plugin-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "17ae9ca47b70d931504555c3572ce4ad", "sha256": "9d85708a3e14270212c7d2c0e1ab8f254eb129bad40ed19c61a3469deaa0ba5b" }, "downloads": -1, "filename": "devicehive_plugin-1.0.3.tar.gz", "has_sig": false, "md5_digest": "17ae9ca47b70d931504555c3572ce4ad", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 15472, "upload_time": "2018-04-10T14:00:11", "url": "https://files.pythonhosted.org/packages/5f/54/32b1fcec785d9377f9281ce4e9dd202df2ff6420e6afa31f66d08a06244a/devicehive_plugin-1.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "17ae9ca47b70d931504555c3572ce4ad", "sha256": "9d85708a3e14270212c7d2c0e1ab8f254eb129bad40ed19c61a3469deaa0ba5b" }, "downloads": -1, "filename": "devicehive_plugin-1.0.3.tar.gz", "has_sig": false, "md5_digest": "17ae9ca47b70d931504555c3572ce4ad", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", "size": 15472, "upload_time": "2018-04-10T14:00:11", "url": "https://files.pythonhosted.org/packages/5f/54/32b1fcec785d9377f9281ce4e9dd202df2ff6420e6afa31f66d08a06244a/devicehive_plugin-1.0.3.tar.gz" } ] }