Basic Dweet
Basic APIs of the free dweet service. Dweet is a simple machine-to-machine (M2M) service from dweet.io.
This module only supports these dweet APIs of the free dweet service:
dweet forget latest dweet forget dweets for
It also can be used in MicroPython.
Installation
Synchronous Programming
pip install basicdweet
Asynchronous Programming
pip install basicdweet[aiohttp]
Usage
Synchronous Programming
Code
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"))
Output
{'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'}}]
Asynchronous Programming
Code
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())
Output
{'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'}}]
Test
python -m pytest
Build documentation
mkdocs build
Metadata
Release files for basicdweet 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| basicdweet-0.4.0.tar.gz | 4.7 kB | Without provenance | Details for basicdweet-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| basicdweet-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for basicdweet-0.4.0-py3-none-any.whl |
Total release size: 9.9 kB
Release files / basicdweet-0.4.0.tar.gz
| Download URL | basicdweet-0.4.0.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
49f6a816fec1ae718f2cc78ed5e861eb20a549eddd0045688f073bf0a05ab1dd
|
|
BLAKE2b-256 checksum How to use checksums |
9dffc068a4eb27b5547d98383f3f2fb27fc28da465e36d5bbb46c707107e792f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Release files / basicdweet-0.4.0-py3-none-any.whl
| Download URL | basicdweet-0.4.0-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
24d7386262dedf28cd165c5f8c93b101df70cd6feb0bf72dd1f0b58f8c4a05de
|
|
BLAKE2b-256 checksum How to use checksums |
1aff19db5fd07ac0e8b4c24543940730753250096770b7b88b9b04a2288c1ebf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Security for basicdweet 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.