datasette-webhook-write
Datasette plugin to write to database via verified webhooks
Installation
Install this plugin in the same environment as Datasette.
$ datasette install datasette-webhook-write
Usage (datasette/receiving side)
This plugin allows writing to a datasette database via hmac-signed http POST calls.
Example for metadata.yml (for usage to receive texts from https://nlg.ax/):
plugins:
datasette-webhook-write:
webhook_secret:
"$env": "WEBHOOK_SECRET"
http_header_name: "x-myax-signature"
database_name: "example"
table_name: "generated_texts"
use_pk:
- "uid"
- "collection_id"
WEBHOOK_SECRET is set as environment variable.
The url to upload to the datasette instance is /-/webhook-write/.
Usage (pushing side)
The json data pushed has to be signed with the WEBHOOK_SECRET and added to the headers of the POST call.
Generate the hmac signature (where document is the data you want to send, and WEBHOOK_SECRET is the secret only pushing+receving parties should know):
digest = hmac.new(
key=WEBHOOK_SECRET.encode(),
msg=json.dumps(document).encode(),
digestmod=hashlib.sha1,
)
header = {
"X-SIGNATURE": f"sha1={digest.hexdigest()}",
}
The pushed data is written to the database only when secret+document are generating the same digest.
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-webhook-write
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
python -m pip install -e '.[test]'
To run the tests:
python -m pytest
Metadata
Release files for datasette-webhook-write 0.5.1
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 |
|---|---|---|---|---|
| datasette_webhook_write-0.5.1.tar.gz | 9.2 kB | Without provenance | Details for datasette_webhook_write-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| datasette_webhook_write-0.5.1-py3-none-any.whl | Python 3 | none | any | Details for datasette_webhook_write-0.5.1-py3-none-any.whl |
Total release size: 17.4 kB
Release files / datasette_webhook_write-0.5.1.tar.gz
| Download URL | datasette_webhook_write-0.5.1.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5f6f795e95ac5f449eac7985e145f46120150d75f3b791273ad579943b567a7
|
|
BLAKE2b-256 checksum How to use checksums |
4b65aceaa3424a8b4d66ecc5b9e72af5619f41a061a30522027415e27f42e732
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / datasette_webhook_write-0.5.1-py3-none-any.whl
| Download URL | datasette_webhook_write-0.5.1-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c844f28de56f9eada14b26d6e6ec378ab65784100e1b973e5a56e4bc7ea59f90
|
|
BLAKE2b-256 checksum How to use checksums |
a6a78c86ca9142e5c14c776384e5840629d5860376b2fdf35c7e7b70aa22ac54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Security for datasette-webhook-write 0.5.1
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.