Name | basicdweet JSON |
Version |
0.4.0
JSON |
| download |
home_page | None |
Summary | Basic APIs of the free dweet service. |
upload_time | 2024-07-08 02:04:37 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | MIT License Copyright (c) 2024 Quan Lin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
dweet
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Basic Dweet
[![PyPI version][pypi_img]][pypi_link]
[![Downloads][downloads_img]][downloads_link]
[pypi_img]: https://badge.fury.io/py/basicdweet.svg
[pypi_link]: https://badge.fury.io/py/basicdweet
[downloads_img]: https://pepy.tech/badge/basicdweet
[downloads_link]: https://pepy.tech/project/basicdweet
[Documentation](https://jacklinquan.github.io/basicdweet)
Basic APIs of the free dweet service.
Dweet is a simple machine-to-machine (M2M) service from [dweet.io](https://dweet.io).
This module only supports these dweet APIs of the free dweet service:
- `dweet for`
- `get latest dweet for`
- `get dweets for`
It also can be used in MicroPython.
## Installation
### Synchronous Programming
```shell
pip install basicdweet
```
### Asynchronous Programming
```shell
pip install basicdweet[aiohttp]
```
## Usage
### Synchronous Programming
<details open><summary>Code</summary>
```python
import time
import basicdweet
print(basicdweet.dweet_for("YOUR_THING", {"YOUR_DATA": "YOUR_VALUE"}))
time.sleep(2)
print(basicdweet.get_latest_dweet_for("YOUR_THING"))
time.sleep(2)
print(basicdweet.dweet_for("YOUR_THING", {"YOUR_DATA": "YOUR_VALUE_2"}))
time.sleep(2)
print(basicdweet.get_latest_dweet_for("YOUR_THING"))
time.sleep(2)
print(basicdweet.get_dweets_for("YOUR_THING"))
```
</details>
<details open><summary>Output</summary>
```
{'thing': 'YOUR_THING', 'created': '2024-07-05T04:53:36.896Z', 'content': {'YOUR_DATA': 'YOUR_VALUE'}, 'transaction': '9cd0b361-05fc-451d-be7b-280172242f25'}
[{'thing': 'YOUR_THING', 'created': '2024-07-05T04:53:36.896Z', 'content': {'YOUR_DATA': 'YOUR_VALUE'}}]
{'thing': 'YOUR_THING', 'created': '2024-07-05T04:53:42.697Z', 'content': {'YOUR_DATA': 'YOUR_VALUE_2'}, 'transaction': '926d396d-cf41-4feb-89c3-46ffb0960053'}
[{'thing': 'YOUR_THING', 'created': '2024-07-05T04:53:42.697Z', 'content': {'YOUR_DATA': 'YOUR_VALUE_2'}}]
[{'thing': 'YOUR_THING', 'created': '2024-07-05T04:53:42.697Z', 'content': {'YOUR_DATA': 'YOUR_VALUE_2'}}, {'thing': 'YOUR_THING', 'created': '2024-07-05T04:53:36.896Z', 'content': {'YOUR_DATA': 'YOUR_VALUE'}}]
```
</details>
### Asynchronous Programming
<details><summary>Code</summary>
```python
import asyncio
import basicdweet
async def async_test():
print(await basicdweet.async_dweet_for("YOUR_THING", {"YOUR_DATA": "YOUR_VALUE"}))
await asyncio.sleep(2)
print(await basicdweet.async_get_latest_dweet_for("YOUR_THING"))
await asyncio.sleep(2)
print(await basicdweet.async_dweet_for("YOUR_THING", {"YOUR_DATA": "YOUR_VALUE_2"}))
await asyncio.sleep(2)
print(await basicdweet.async_get_latest_dweet_for("YOUR_THING"))
await asyncio.sleep(2)
print(await basicdweet.async_get_dweets_for("YOUR_THING"))
asyncio.run(async_test())
```
</details>
<details><summary>Output</summary>
```
{'thing': 'YOUR_THING', 'created': '2024-07-05T04:58:08.829Z', 'content': {'YOUR_DATA': 'YOUR_VALUE'}, 'transaction': '12d7e422-e8ce-408c-be0c-d61cc5d3d730'}
[{'thing': 'YOUR_THING', 'created': '2024-07-05T04:58:08.829Z', 'content': {'YOUR_DATA': 'YOUR_VALUE'}}]
{'thing': 'YOUR_THING', 'created': '2024-07-05T04:58:14.650Z', 'content': {'YOUR_DATA': 'YOUR_VALUE_2'}, 'transaction': 'ffbb2f4e-f954-4b4c-887e-7a492c0ce0ba'}
[{'thing': 'YOUR_THING', 'created': '2024-07-05T04:58:14.650Z', 'content': {'YOUR_DATA': 'YOUR_VALUE_2'}}]
[{'thing': 'YOUR_THING', 'created': '2024-07-05T04:58:14.650Z', 'content': {'YOUR_DATA': 'YOUR_VALUE_2'}}, {'thing': 'YOUR_THING', 'created': '2024-07-05T04:58:08.829Z', 'content': {'YOUR_DATA': 'YOUR_VALUE'}}]
```
</details>
## Test
```shell
python -m pytest
```
## Build documentation
```shell
mkdocs build
```
Raw data
{
"_id": null,
"home_page": null,
"name": "basicdweet",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "dweet",
"author": null,
"author_email": "Quan Lin <jacklinquan@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/9d/ff/c068a4eb27b5547d98383f3f2fb27fc28da465e36d5bbb46c707107e792f/basicdweet-0.4.0.tar.gz",
"platform": null,
"description": "# Basic Dweet\r\n\r\n[![PyPI version][pypi_img]][pypi_link]\r\n[![Downloads][downloads_img]][downloads_link]\r\n\r\n [pypi_img]: https://badge.fury.io/py/basicdweet.svg\r\n [pypi_link]: https://badge.fury.io/py/basicdweet\r\n [downloads_img]: https://pepy.tech/badge/basicdweet\r\n [downloads_link]: https://pepy.tech/project/basicdweet\r\n\r\n[Documentation](https://jacklinquan.github.io/basicdweet)\r\n\r\nBasic APIs of the free dweet service.\r\nDweet is a simple machine-to-machine (M2M) service from [dweet.io](https://dweet.io).\r\n\r\nThis module only supports these dweet APIs of the free dweet service:\r\n\r\n- `dweet for`\r\n- `get latest dweet for`\r\n- `get dweets for`\r\n\r\nIt also can be used in MicroPython.\r\n\r\n## Installation\r\n\r\n### Synchronous Programming\r\n\r\n```shell\r\npip install basicdweet\r\n```\r\n\r\n### Asynchronous Programming\r\n\r\n```shell\r\npip install basicdweet[aiohttp]\r\n```\r\n\r\n## Usage\r\n\r\n### Synchronous Programming\r\n\r\n<details open><summary>Code</summary>\r\n\r\n```python\r\nimport time\r\nimport basicdweet\r\n\r\nprint(basicdweet.dweet_for(\"YOUR_THING\", {\"YOUR_DATA\": \"YOUR_VALUE\"}))\r\ntime.sleep(2)\r\nprint(basicdweet.get_latest_dweet_for(\"YOUR_THING\"))\r\ntime.sleep(2)\r\nprint(basicdweet.dweet_for(\"YOUR_THING\", {\"YOUR_DATA\": \"YOUR_VALUE_2\"}))\r\ntime.sleep(2)\r\nprint(basicdweet.get_latest_dweet_for(\"YOUR_THING\"))\r\ntime.sleep(2)\r\nprint(basicdweet.get_dweets_for(\"YOUR_THING\"))\r\n```\r\n</details>\r\n\r\n<details open><summary>Output</summary>\r\n\r\n```\r\n{'thing': 'YOUR_THING', 'created': '2024-07-05T04:53:36.896Z', 'content': {'YOUR_DATA': 'YOUR_VALUE'}, 'transaction': '9cd0b361-05fc-451d-be7b-280172242f25'}\r\n[{'thing': 'YOUR_THING', 'created': '2024-07-05T04:53:36.896Z', 'content': {'YOUR_DATA': 'YOUR_VALUE'}}]\r\n{'thing': 'YOUR_THING', 'created': '2024-07-05T04:53:42.697Z', 'content': {'YOUR_DATA': 'YOUR_VALUE_2'}, 'transaction': '926d396d-cf41-4feb-89c3-46ffb0960053'}\r\n[{'thing': 'YOUR_THING', 'created': '2024-07-05T04:53:42.697Z', 'content': {'YOUR_DATA': 'YOUR_VALUE_2'}}]\r\n[{'thing': 'YOUR_THING', 'created': '2024-07-05T04:53:42.697Z', 'content': {'YOUR_DATA': 'YOUR_VALUE_2'}}, {'thing': 'YOUR_THING', 'created': '2024-07-05T04:53:36.896Z', 'content': {'YOUR_DATA': 'YOUR_VALUE'}}]\r\n```\r\n</details>\r\n\r\n### Asynchronous Programming\r\n\r\n<details><summary>Code</summary>\r\n\r\n```python\r\nimport asyncio\r\nimport basicdweet\r\n\r\nasync def async_test():\r\n print(await basicdweet.async_dweet_for(\"YOUR_THING\", {\"YOUR_DATA\": \"YOUR_VALUE\"}))\r\n await asyncio.sleep(2)\r\n print(await basicdweet.async_get_latest_dweet_for(\"YOUR_THING\"))\r\n await asyncio.sleep(2)\r\n print(await basicdweet.async_dweet_for(\"YOUR_THING\", {\"YOUR_DATA\": \"YOUR_VALUE_2\"}))\r\n await asyncio.sleep(2)\r\n print(await basicdweet.async_get_latest_dweet_for(\"YOUR_THING\"))\r\n await asyncio.sleep(2)\r\n print(await basicdweet.async_get_dweets_for(\"YOUR_THING\"))\r\n\r\nasyncio.run(async_test())\r\n```\r\n</details>\r\n\r\n<details><summary>Output</summary>\r\n\r\n```\r\n{'thing': 'YOUR_THING', 'created': '2024-07-05T04:58:08.829Z', 'content': {'YOUR_DATA': 'YOUR_VALUE'}, 'transaction': '12d7e422-e8ce-408c-be0c-d61cc5d3d730'}\r\n[{'thing': 'YOUR_THING', 'created': '2024-07-05T04:58:08.829Z', 'content': {'YOUR_DATA': 'YOUR_VALUE'}}]\r\n{'thing': 'YOUR_THING', 'created': '2024-07-05T04:58:14.650Z', 'content': {'YOUR_DATA': 'YOUR_VALUE_2'}, 'transaction': 'ffbb2f4e-f954-4b4c-887e-7a492c0ce0ba'}\r\n[{'thing': 'YOUR_THING', 'created': '2024-07-05T04:58:14.650Z', 'content': {'YOUR_DATA': 'YOUR_VALUE_2'}}]\r\n[{'thing': 'YOUR_THING', 'created': '2024-07-05T04:58:14.650Z', 'content': {'YOUR_DATA': 'YOUR_VALUE_2'}}, {'thing': 'YOUR_THING', 'created': '2024-07-05T04:58:08.829Z', 'content': {'YOUR_DATA': 'YOUR_VALUE'}}]\r\n```\r\n</details>\r\n\r\n## Test\r\n\r\n```shell\r\npython -m pytest\r\n```\r\n\r\n## Build documentation\r\n\r\n```shell\r\nmkdocs build\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Quan Lin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Basic APIs of the free dweet service.",
"version": "0.4.0",
"project_urls": {
"Homepage": "https://github.com/jacklinquan/basicdweet"
},
"split_keywords": [
"dweet"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1aff19db5fd07ac0e8b4c24543940730753250096770b7b88b9b04a2288c1ebf",
"md5": "e204ef28976425c5a4ddd6fc4733ca32",
"sha256": "24d7386262dedf28cd165c5f8c93b101df70cd6feb0bf72dd1f0b58f8c4a05de"
},
"downloads": -1,
"filename": "basicdweet-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e204ef28976425c5a4ddd6fc4733ca32",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5220,
"upload_time": "2024-07-08T02:04:36",
"upload_time_iso_8601": "2024-07-08T02:04:36.143008Z",
"url": "https://files.pythonhosted.org/packages/1a/ff/19db5fd07ac0e8b4c24543940730753250096770b7b88b9b04a2288c1ebf/basicdweet-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9dffc068a4eb27b5547d98383f3f2fb27fc28da465e36d5bbb46c707107e792f",
"md5": "2e1213f57fa8c0ad10e44d7e03fb52e5",
"sha256": "49f6a816fec1ae718f2cc78ed5e861eb20a549eddd0045688f073bf0a05ab1dd"
},
"downloads": -1,
"filename": "basicdweet-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "2e1213f57fa8c0ad10e44d7e03fb52e5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4653,
"upload_time": "2024-07-08T02:04:37",
"upload_time_iso_8601": "2024-07-08T02:04:37.878435Z",
"url": "https://files.pythonhosted.org/packages/9d/ff/c068a4eb27b5547d98383f3f2fb27fc28da465e36d5bbb46c707107e792f/basicdweet-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-08 02:04:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jacklinquan",
"github_project": "basicdweet",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "basicdweet"
}