timod
Library for creating ThingsDB modules using the Python language
Installation
$ pip install py-timod
Usage
Modules for ThingsDB read from stdin and write a response back to stdout. Work by the module must be non-blocking.
If the module requires configuration data, for example a connection string, then this configuration will be send immediately after start-up but may be received again when the module configuration is changed in ThingsDB.
Do not use functions like print since these function will write to stdout and this is reserved for ThingsDB. Instead, use logging... to write to stderr instead.
The following code may be used as a template: (see: https://github.com/thingsdb/ThingsDB/tree/master/modules/python/demo.py)
import logging
from typing import Any
from timod import start_module, TiHandler, LookupError
class Handler(TiHandler):
async def on_config(self, cfg: Any):
logging.info(cfg)
async def on_request(self, req: dict[str, Any]):
if 'message' not in req:
raise LookupError('missing `message` in request')
return req['message']
if __name__ == '__main__':
start_module('demo', Handler())
Metadata
Release files for py-timod 1.0.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 |
|---|---|---|---|---|
| py_timod-1.0.0.tar.gz | 17.4 kB | Without provenance | Details for py_timod-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_timod-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for py_timod-1.0.0-py3-none-any.whl |
Total release size: 35.3 kB
Release files / py_timod-1.0.0.tar.gz
| Download URL | py_timod-1.0.0.tar.gz |
|---|---|
| Size | 17.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d32b267c18e11f4244416fe890671d1dbd47c11b8530a594ce0fc055238d27d
|
|
BLAKE2b-256 checksum How to use checksums |
b3bec0c04d9306b9ce38404ede28c0db6f040e12cdb4595c8669a3cb04ea00a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.1
|
Release files / py_timod-1.0.0-py3-none-any.whl
| Download URL | py_timod-1.0.0-py3-none-any.whl |
|---|---|
| Size | 18.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96b4c87ac9809f9e615b25c2d42f24d23023f0029315fd21a05cfc19e7a17940
|
|
BLAKE2b-256 checksum How to use checksums |
106a03764c71861e287bd2408f663de7f81e9961c47765cb0cbbd0307cc9e235
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.1
|
Security for py-timod 1.0.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.