{ "info": { "author": "Johan Niklasson", "author_email": "johan@nik-dev.se", "bugtrack_url": null, "classifiers": [], "description": "# NikDev IoT Client (Python)\n\n**Python API for accessing the NikDev IoT Server**\n\nThis package is serving as an API client for accessing the [NikDev IoT Server](https://iot.nik-dev.se/admin/login),\nand simplify uploading data to the server.\n\n## Installation\n\nUsing pip:\n\n pip install nikdev-iot\n\nFrom source:\n\n python setup.py install\n\n\n## Using the API\n\nBefore using the API you need to [create an account](https://iot.nik-dev.se/admin/register)\nand a device to connect against.\n\n### Finding ID and Keys\n\nIn order to connect to the server you need a Device ID and an API Key.\nBoth the Device ID and API Key are of a UUID structure:\n`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`.\n\nThe Device ID is found on the first view when you open your device on the\nServer GUI, and the API Key can be found under the section API Keys\nunder the same device. If you don't have an API Key you can create one.\n\n### Importing and initializing\nTo import the API, use the following:\n```python\nfrom nikdev_iot import Api, PushException, GetException\n```\n\nThe `PushException` and `GetException` can be good to import to catch eventual \nerrors when sending or receiving data.\n\nTo initialize the API class, there's 2 options. Either you can\npass a dict with configuration values, or you can create it from\nentering the credentials. The second option is handy if you want\nto use the default configuration.\n\n```python\n# Method 1: initialization with a dict.\napi = Api({\n 'deviceId': '',\n 'apiKey': ''\n})\n\n# Method 2: initialization with credentials.\napi = Api.from_credentials('', '')\n```\n\n### Test connection\n> Not implemented yet.\n\n### Storing data\nIn order to add and store data to the API, you must pass the data as key-value pairs.\n\n```python\napi.add_value('', '')\napi.add_value('', '')\n```\n\nTrying to add 2 values with the same Field ID will overwrite the previous value.\n\nAfter entering all values you'd like to store you must commit them.\nCommitting values will lock them, just like a commit in git, and is\nprepared to be pushed.\n\n```python\napi.add_value(...)\napi.commit()\n```\n\n> The terminology is on purpose made to mirror git commands as much\n> as possible, since it's a simple way to get a quick start on the API\n> (assumed you know some of the git commands).\n\n\n### Uploading data\nAfter you've committed your values it's time to uoload them.\nUploading is done by calling `push()`. This will try to upload\nany committed values to the server. If there's unpushed committed\nvalues they will be uploaded as well.\n\n```python\napi.add_value(...)\napi.commit()\napi.push()\n```\n\nIt's possible to run both commit and push in one function\ncall by using `commit_and_push()`.\n```python\napi.add_value(...)\napi.commit_and_push()\n```\n\nNormally you don't get any response from either `commit()` or `push()`.\nHowever, if there's an error when uploading the values `push()` will throw an\n`PushException`. This can be done for a number of reasons, but the important cases are:\n - You entered wrong Device ID or API Key\n - Your API Key doesn't have write access (this can easily be fixed from the Server GUI)\n - The server messed up.\n - The connection timed out.\n\nThe last two reasons are categorized as \"Bad Luck\" and you can try again to upload your data.\nHowever, if there's anything wrong with the Device ID or API Key (entered wrong or doesn't have access)\nyour committed values will be thrown away.\n\nif you want to catch these exceptions, just wrap the push command with a `try/exception clause` and\ncatch `PushException`:\n\n```python\ntry:\n # Try to push the values to the server\n api.push()\nexcept PushException as exception:\n if exception.retained_data:\n pass\n # The data is still intact and can be re-pushed\n else:\n pass\n # The data is no more.\n pass\n```\n\n### Full example\n\n```python\n# Importing the API\nfrom nikdev_iot import Api, PushException\n\n# Initialize the api from credentials\napi = Api.from_credentials('', '')\n\n# Add values to be uploaded\napi.add_value('', '')\napi.add_value('', '')\n# Commit the values to \"lock\" them, meaning you can add\n# new values of the same Field ID without overwriting the previous.\napi.commit()\n\n# Adding am additional value for Field ID 1\napi.add_value('', '')\n# Commit that value as well\napi.commit()\n\ntry:\n # Try to push the values to the server\n api.push()\nexcept PushException as exception:\n # Check if the data was retained\n if exception.retained_data:\n # If so, sleep for a while and try to push it again.\n import time; time.sleep(2)\n # This time it's without try catch, if we fail here the program crashes.\n api.push()\n pass\n\n```\n\n### Fetching data\n> Not implemented yet.\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://github.com/Niklasson-Development/nikdev_iot_python", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "nikdev-iot", "package_url": "https://pypi.org/project/nikdev-iot/", "platform": "", "project_url": "https://pypi.org/project/nikdev-iot/", "project_urls": { "Homepage": "https://github.com/Niklasson-Development/nikdev_iot_python" }, "release_url": "https://pypi.org/project/nikdev-iot/0.5.5/", "requires_dist": [ "requests (<3,>=2.19)" ], "requires_python": ">=2.7, <4", "summary": "Python API for NikDev IoT server.", "version": "0.5.5" }, "last_serial": 4993468, "releases": { "0.4.2b1": [ { "comment_text": "", "digests": { "md5": "fd8ddc8255f110498e7fe6e729805075", "sha256": "428b108d0462809bbffdaf9f46db00e8cd04a98a3dbe512c495248e7a156b897" }, "downloads": -1, "filename": "nikdev_iot-0.4.2b1-py2-none-any.whl", "has_sig": false, "md5_digest": "fd8ddc8255f110498e7fe6e729805075", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": "<3", "size": 13315, "upload_time": "2019-03-27T13:31:55", "url": "https://files.pythonhosted.org/packages/4a/ec/b61ed398c8aa2967a040a9c5ad477291e3f2d39f2ff2ceebb5b0913c45f2/nikdev_iot-0.4.2b1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e354cc8b7643728e009c2155190ecfc8", "sha256": "80b738d56f5e5aa62503c959cdc67bdf11f8db2d531c5508d082afc3b5209b3d" }, "downloads": -1, "filename": "nikdev_iot-0.4.2b1.tar.gz", "has_sig": false, "md5_digest": "e354cc8b7643728e009c2155190ecfc8", "packagetype": "sdist", "python_version": "source", "requires_python": "<3", "size": 9879, "upload_time": "2019-03-27T13:31:57", "url": "https://files.pythonhosted.org/packages/66/ca/fe29c40db637f6086c3518fab0b105d92cceb8124688947150726edefdd9/nikdev_iot-0.4.2b1.tar.gz" } ], "0.5.0rc1": [ { "comment_text": "", "digests": { "md5": "26bb28c0827096e50def9f1ffa029bdc", "sha256": "4b824d37b791878662bf4cc1afd81d934ac9f3fc466eb4ab5e72e41d50ba8e53" }, "downloads": -1, "filename": "nikdev_iot-0.5.0rc1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "26bb28c0827096e50def9f1ffa029bdc", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, <4", "size": 13418, "upload_time": "2019-03-27T15:05:17", "url": "https://files.pythonhosted.org/packages/cb/ed/6f44614690568aedc3f90ce1b84baeccf7b1959c0a5b0ff7e87ac1411b1c/nikdev_iot-0.5.0rc1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d9ea56384221b5a31b927344cb22d158", "sha256": "c315d6a610901d9b8df47051657817908a8cd280fea2d87f483e01d07670e5b4" }, "downloads": -1, "filename": "nikdev_iot-0.5.0rc1.tar.gz", "has_sig": false, "md5_digest": "d9ea56384221b5a31b927344cb22d158", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, <4", "size": 9975, "upload_time": "2019-03-27T15:05:20", "url": "https://files.pythonhosted.org/packages/2c/5b/e4cf147d17e2c06ccf46621dbeee6411db817a4f16483dc7fe1ccb8f1e7a/nikdev_iot-0.5.0rc1.tar.gz" } ], "0.5.1rc1": [ { "comment_text": "", "digests": { "md5": "05db7931fe02b44b60e381916aa1d186", "sha256": "2f7f16399338a4f552b08873d507a76a383f2ec0fec32c20c5c049a0a5a38764" }, "downloads": -1, "filename": "nikdev_iot-0.5.1rc1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "05db7931fe02b44b60e381916aa1d186", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, <4", "size": 15146, "upload_time": "2019-03-27T15:14:08", "url": "https://files.pythonhosted.org/packages/6e/98/65996bee6ede6e71f185566b76fb7f618a5a4c55f9aa5961947059821b74/nikdev_iot-0.5.1rc1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f631ab88d6fedac9799aaeae6b814210", "sha256": "a7aa853b09aca36d6e383cc07b74c989ee72e4c46c0c5af44fc16736510c3cd8" }, "downloads": -1, "filename": "nikdev_iot-0.5.1rc1.tar.gz", "has_sig": false, "md5_digest": "f631ab88d6fedac9799aaeae6b814210", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, <4", "size": 12119, "upload_time": "2019-03-27T15:14:10", "url": "https://files.pythonhosted.org/packages/c1/b9/99ce7b163929d9cd7e4a5a3a44b972a31419cc52d9a0ba5ed2eaf6f662b3/nikdev_iot-0.5.1rc1.tar.gz" } ], "0.5.2rc1": [ { "comment_text": "", "digests": { "md5": "123d90ac0f1cd1e1c91820d7326a1f0b", "sha256": "e3157e362b0eaaff1dd0d61a39669969a2b7bc4bd58f6f58c32428cef1efbd7e" }, "downloads": -1, "filename": "nikdev_iot-0.5.2rc1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "123d90ac0f1cd1e1c91820d7326a1f0b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, <4", "size": 15174, "upload_time": "2019-03-27T15:16:01", "url": "https://files.pythonhosted.org/packages/1b/86/7ecc911e54424f50f0a18e3afbe2d617800063f14a56ea5ec970e8e48f57/nikdev_iot-0.5.2rc1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b9b057b62984651e89891daa18489122", "sha256": "29bd51f3d202ea708b7cc9aa2db2e26ee3b5a290da25c8823b803f3541e62f56" }, "downloads": -1, "filename": "nikdev_iot-0.5.2rc1.tar.gz", "has_sig": false, "md5_digest": "b9b057b62984651e89891daa18489122", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, <4", "size": 12178, "upload_time": "2019-03-27T15:16:02", "url": "https://files.pythonhosted.org/packages/1d/e2/184f3537b6fc09f94f37f9efe3045a64092e97283a561fbbc89e4ae72022/nikdev_iot-0.5.2rc1.tar.gz" } ], "0.5.3rc1": [ { "comment_text": "", "digests": { "md5": "e854a5184dce9d744d20858cf0db392b", "sha256": "71dbc097233ce3dfd09b7ed4d8581d0239bf6276768305431c7619b1bd90d2e0" }, "downloads": -1, "filename": "nikdev_iot-0.5.3rc1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e854a5184dce9d744d20858cf0db392b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, <4", "size": 15208, "upload_time": "2019-03-27T15:25:28", "url": "https://files.pythonhosted.org/packages/96/0c/14e40c52da3097a7a21c4266a32c59cff73f3c694e5b8984024e919a928b/nikdev_iot-0.5.3rc1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bba21168ec828a7a18caaca0d36d62b2", "sha256": "54493968f6bd44279f88a5282f3840a133d9aadc08d96dc6a862a314eed4080d" }, "downloads": -1, "filename": "nikdev_iot-0.5.3rc1.tar.gz", "has_sig": false, "md5_digest": "bba21168ec828a7a18caaca0d36d62b2", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, <4", "size": 12274, "upload_time": "2019-03-27T15:25:30", "url": "https://files.pythonhosted.org/packages/89/06/d18739f2545f0019235029da9150b4211b479791036b6c4708d242a7e9b6/nikdev_iot-0.5.3rc1.tar.gz" } ], "0.5.4": [ { "comment_text": "", "digests": { "md5": "44f7091c1ea8a6454a7e0d2db29dccbe", "sha256": "58ae412a4562302d815cd86297520698b90abddccef069ad621fea3bf7c024d7" }, "downloads": -1, "filename": "nikdev_iot-0.5.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "44f7091c1ea8a6454a7e0d2db29dccbe", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, <4", "size": 15219, "upload_time": "2019-03-27T15:34:21", "url": "https://files.pythonhosted.org/packages/03/b8/ffba27eedefbec2e9d9aba80f6d93e8ce29b0fa2f51557bd0a01fbd32fd4/nikdev_iot-0.5.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cd018336cb0971eaea4022dee4394454", "sha256": "b5acb885e8a85cfedb485da5abaf8ec3f070b18c5b6fbdb6f59c93ba41c246be" }, "downloads": -1, "filename": "nikdev_iot-0.5.4.tar.gz", "has_sig": false, "md5_digest": "cd018336cb0971eaea4022dee4394454", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, <4", "size": 12345, "upload_time": "2019-03-27T15:34:23", "url": "https://files.pythonhosted.org/packages/22/dc/a25e1d51600dca4d3fb6ed80e5dc43a71aed84f406fab35190ca5965b0d8/nikdev_iot-0.5.4.tar.gz" } ], "0.5.5": [ { "comment_text": "", "digests": { "md5": "7d85bf05f4f17dc8fb735760932b0f17", "sha256": "35e14b89ddd678016faf0fd2c3af55ec459a877f2c6cf2d91762d1d2ede829cf" }, "downloads": -1, "filename": "nikdev_iot-0.5.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7d85bf05f4f17dc8fb735760932b0f17", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, <4", "size": 15222, "upload_time": "2019-03-27T15:35:19", "url": "https://files.pythonhosted.org/packages/fd/71/52de95cc0e3499d9455979b6c30d45045019e124544e1d0c4630818e515d/nikdev_iot-0.5.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c9c6f15a537ce02590e7d2e61ba69034", "sha256": "e1567153f336414259e3438229d9ab09e9e281c569ad7e56315f93df884af4ee" }, "downloads": -1, "filename": "nikdev_iot-0.5.5.tar.gz", "has_sig": false, "md5_digest": "c9c6f15a537ce02590e7d2e61ba69034", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, <4", "size": 12347, "upload_time": "2019-03-27T15:35:22", "url": "https://files.pythonhosted.org/packages/5e/3a/9a8667c069b8ac6d3bcc8804ebb0e8170875cee2bc1a814eb011f98615e1/nikdev_iot-0.5.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7d85bf05f4f17dc8fb735760932b0f17", "sha256": "35e14b89ddd678016faf0fd2c3af55ec459a877f2c6cf2d91762d1d2ede829cf" }, "downloads": -1, "filename": "nikdev_iot-0.5.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7d85bf05f4f17dc8fb735760932b0f17", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.7, <4", "size": 15222, "upload_time": "2019-03-27T15:35:19", "url": "https://files.pythonhosted.org/packages/fd/71/52de95cc0e3499d9455979b6c30d45045019e124544e1d0c4630818e515d/nikdev_iot-0.5.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c9c6f15a537ce02590e7d2e61ba69034", "sha256": "e1567153f336414259e3438229d9ab09e9e281c569ad7e56315f93df884af4ee" }, "downloads": -1, "filename": "nikdev_iot-0.5.5.tar.gz", "has_sig": false, "md5_digest": "c9c6f15a537ce02590e7d2e61ba69034", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, <4", "size": 12347, "upload_time": "2019-03-27T15:35:22", "url": "https://files.pythonhosted.org/packages/5e/3a/9a8667c069b8ac6d3bcc8804ebb0e8170875cee2bc1a814eb011f98615e1/nikdev_iot-0.5.5.tar.gz" } ] }