# reswarm-py
## About
Makes publishing data to a Record Evolution Datapod incredibly easy!
## Usage
```python
import asyncio
from reswarm import Reswarm
# create a reswarm instance, which auto connects to the Record Evolution Platform
# the reswarm instance handles authentication and reconnects when connection is lost
rw = Reswarm()
async def main():
while True:
# publish an event (if connection is not established the publish is skipped)
publication = await rw.publish("test.publish.com", {"temperature": 20})
print(publication)
await asyncio.sleep(3)
if __name__ == "__main__":
# run the main coroutine
asyncio.get_event_loop().create_task(main())
# run the reswarm component
rw.run()
```
## Options
The `Reswarm` `__init__` function can be configured with the following options:
```
{
serial_number: string;
}
```
**serial_number**: Used to set the serial_number of the device if the `DEVICE_SERIAL_NUMBER` environment variable does not exist. It can also be used if the user wishes to authenticate as another device.
## Advanced Usage
If you need more control, e.g. acting on lifecycle events (`onJoin`, `onLeave`) take a look at
the [examples](./examples/) folder.
Raw data
{
"_id": null,
"home_page": "https://github.com/RecordEvolution/reswarm-python",
"name": "reswarm",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Record Evolution GmbH",
"author_email": "marko.petzold@record-evolution.de",
"download_url": "https://files.pythonhosted.org/packages/75/92/ab7645d3f637ad28e85d49a6c9a1882034e1d22150be96921face469a1f1/reswarm-0.0.19.tar.gz",
"platform": null,
"description": "# reswarm-py\n\n## About\n\nMakes publishing data to a Record Evolution Datapod incredibly easy!\n\n## Usage\n\n```python\nimport asyncio\nfrom reswarm import Reswarm\n\n# create a reswarm instance, which auto connects to the Record Evolution Platform\n# the reswarm instance handles authentication and reconnects when connection is lost\nrw = Reswarm()\n\nasync def main():\n while True:\n # publish an event (if connection is not established the publish is skipped)\n publication = await rw.publish(\"test.publish.com\", {\"temperature\": 20})\n print(publication)\n await asyncio.sleep(3)\n\n\nif __name__ == \"__main__\":\n # run the main coroutine\n asyncio.get_event_loop().create_task(main())\n # run the reswarm component\n rw.run()\n```\n\n## Options\n\nThe `Reswarm` `__init__` function can be configured with the following options:\n\n```\n{\n serial_number: string;\n}\n```\n\n**serial_number**: Used to set the serial_number of the device if the `DEVICE_SERIAL_NUMBER` environment variable does not exist. It can also be used if the user wishes to authenticate as another device.\n\n## Advanced Usage\n\nIf you need more control, e.g. acting on lifecycle events (`onJoin`, `onLeave`) take a look at\nthe [examples](./examples/) folder.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Aids users in publishing data to a Record Evolution Datapod",
"version": "0.0.19",
"project_urls": {
"Homepage": "https://github.com/RecordEvolution/reswarm-python"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2ff09fe0644d688b63d02e9be327f44398f9d7e10c47747958e7709d76e682ec",
"md5": "d053a3151b59dd58732de895b32adf4a",
"sha256": "53f9ae4360453a8da558d1f76d5dea8ee4663dc4b3b6813e23d58e4a64e9f372"
},
"downloads": -1,
"filename": "reswarm-0.0.19-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d053a3151b59dd58732de895b32adf4a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 5681,
"upload_time": "2024-01-06T16:18:01",
"upload_time_iso_8601": "2024-01-06T16:18:01.592333Z",
"url": "https://files.pythonhosted.org/packages/2f/f0/9fe0644d688b63d02e9be327f44398f9d7e10c47747958e7709d76e682ec/reswarm-0.0.19-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7592ab7645d3f637ad28e85d49a6c9a1882034e1d22150be96921face469a1f1",
"md5": "20e5d4e3f0e85034a232115659939959",
"sha256": "3d8cbf537d6c1040579adf6abe03743e36eb445584ea9c186b9a2437c53874cb"
},
"downloads": -1,
"filename": "reswarm-0.0.19.tar.gz",
"has_sig": false,
"md5_digest": "20e5d4e3f0e85034a232115659939959",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 5076,
"upload_time": "2024-01-06T16:18:03",
"upload_time_iso_8601": "2024-01-06T16:18:03.661821Z",
"url": "https://files.pythonhosted.org/packages/75/92/ab7645d3f637ad28e85d49a6c9a1882034e1d22150be96921face469a1f1/reswarm-0.0.19.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-06 16:18:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "RecordEvolution",
"github_project": "reswarm-python",
"github_not_found": true,
"lcname": "reswarm"
}