{ "info": { "author": "Arnulfo Solis", "author_email": "arnulfojr94@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# Paho's MQTT toolkit\n\nWelcome to Paho's MQTT Toolkit.\n\n## For who? and why?\n\nThis toolkit if for those who have gone through the documentation of the [Paho's MQTT library and its examples](https://www.eclipse.org/paho/clients/python/) and, like me, have felt that the API is somehow off and complicated to onboard applications.\n\nI, personally, like Paho's MQTT library and I don't wish to replace it in anyway. However, I want to write applications that in a way, are familiar to the frameworks I use, e.g., Flask or Sanic.\nAnd therefore, abstracting the underlying implementation by using a solid configuration base with a simplified API.\n\n### What's the base configuration?\n\nThe base configuration of this toolkit uses Paho's event loop implementation by using the `start_loop` and `stop_loop` methods and creating a single entrypoint method that accepts different configuration parameters, `start_async`.\n\n## Simple Usage\n\nFor more examples refer to the examples directory.\n\n\n```python\nimport time\n\nfrom paho.mqtt.client import Client\n\nfrom pahotoolkit import (\n init,\n start_async,\n stop_async,\n subscribe,\n json_message,\n)\n\nfrom my_settings import (\n HOST,\n PORT,\n USERNAME,\n PASSWORD,\n LOG_CONFIG\n)\n\n\n@subscribe('/temperature')\ndef handle_temperature(mqtt_client: Client, userdata, message):\n print(f'Got {message}')\n\n\n@subscribe('/my/topic')\n@json_message() # by default, non-json messages in the topic are ignored\ndef listen_my_topic(payload: dict, *args, **kwargs):\n # todo: do something with the payload\n pass\n\n\n@on_connect()\ndef client_connected(mqtt_client: Client, *args, **kwargs):\n \"\"\"Publish something on_connect.\"\"\"\n mqtt_client.publish('/clients', 'Paho\\'s MQTT toolkit message!')\n\n\n# log_config => https://docs.python.org/3/library/logging.config.html#logging.config.dictConfig\n# the default MQTT Client uses the default's MQTT Client constructor\n# https://github.com/eclipse/paho.mqtt.python#client-1\ndef main():\n client: Client = start_async(host=HOST, port=PORT, # port default to 1883 if not given\n username=USERNAME, password=PASSWORD, # optional fields\n initialize=False, log_config=LOG_CONFIG) # optional fields\n\n init(client) # only required if initialize=False, else by default is automatically called\n\n while True:\n time.sleep(1) # or do something in this thread...\n\n\nif __name__ == '__main__':\n try:\n main()\n finally:\n stop_async()\n```\n\n## Contact\n\nArnulfo Solis\n\n* arnulfojr94@gmail.com\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/kiotsystem/paho-toolkit", "keywords": "paho,eclipse,mqtt,toolkit,framework", "license": "", "maintainer": "", "maintainer_email": "", "name": "pahotoolkitfork", "package_url": "https://pypi.org/project/pahotoolkitfork/", "platform": "any", "project_url": "https://pypi.org/project/pahotoolkitfork/", "project_urls": { "Homepage": "https://bitbucket.org/kiotsystem/paho-toolkit" }, "release_url": "https://pypi.org/project/pahotoolkitfork/0.1.4/", "requires_dist": [ "paho-mqtt (==1.4.0)" ], "requires_python": "", "summary": "Paho's MQTT dev Toolkit", "version": "0.1.4" }, "last_serial": 4399154, "releases": { "0.1.4": [ { "comment_text": "", "digests": { "md5": "2bface5e77c0d5aef45a59aae308909b", "sha256": "210c00b3736df77ef8038d6a39a9c73bde1b272bb7f76c45a21431eb93601a01" }, "downloads": -1, "filename": "pahotoolkitfork-0.1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2bface5e77c0d5aef45a59aae308909b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11959, "upload_time": "2018-10-21T10:49:33", "url": "https://files.pythonhosted.org/packages/38/23/3a90396e02d58acd71d8a498ab236e967679739b6dc62afe7489b9f9e751/pahotoolkitfork-0.1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1d5349efa11e2476bb48d37d37b3b968", "sha256": "cef244ca29397249353010cef86d064f40a38cd64454e15926c4eee9344b6829" }, "downloads": -1, "filename": "pahotoolkitfork-0.1.4.tar.gz", "has_sig": false, "md5_digest": "1d5349efa11e2476bb48d37d37b3b968", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6325, "upload_time": "2018-10-21T10:49:34", "url": "https://files.pythonhosted.org/packages/7f/27/a4b16e7a1ebf204f62927314ce88dfbcff806f5787c0e8e1edcccf18e7ad/pahotoolkitfork-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2bface5e77c0d5aef45a59aae308909b", "sha256": "210c00b3736df77ef8038d6a39a9c73bde1b272bb7f76c45a21431eb93601a01" }, "downloads": -1, "filename": "pahotoolkitfork-0.1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2bface5e77c0d5aef45a59aae308909b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11959, "upload_time": "2018-10-21T10:49:33", "url": "https://files.pythonhosted.org/packages/38/23/3a90396e02d58acd71d8a498ab236e967679739b6dc62afe7489b9f9e751/pahotoolkitfork-0.1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1d5349efa11e2476bb48d37d37b3b968", "sha256": "cef244ca29397249353010cef86d064f40a38cd64454e15926c4eee9344b6829" }, "downloads": -1, "filename": "pahotoolkitfork-0.1.4.tar.gz", "has_sig": false, "md5_digest": "1d5349efa11e2476bb48d37d37b3b968", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6325, "upload_time": "2018-10-21T10:49:34", "url": "https://files.pythonhosted.org/packages/7f/27/a4b16e7a1ebf204f62927314ce88dfbcff806f5787c0e8e1edcccf18e7ad/pahotoolkitfork-0.1.4.tar.gz" } ] }