An api wrapper of Cloudflare Workers KV for Python
Project description
What is this?
This is the api wrapper of Cloudflare Workers KV.
This repo wasn't compatible with bulk import, so I made my own wrapper instead.
You can use this to store and retrieve data from your Cloudflare Workers KV much easier.
Usage
import workers_kv
# get these values from your Cloudflare account
# Create namespace
namespace = workers_kv.Namespace(account_id="WORKERS_KV_ACCOUNT",
namespace_id="WORKERS_KV_NAMESPACE",
api_key="TOKEN")
# List all keys
keys = namespace.list_keys()
# Get value with key
value = namespace.read("keyhere")
# Set value with key
# automatically use bulk import if you have more than 2 key-value pairs
namespace.write({"key1": "value1", "key2": "value2"})
# Delete single key
namespace.delete_one("key1")
# Delete multiple keys (bulk delete)
namespace.delete_many(["key1", "key2"])
## Installation
`pip install -U git+https://github.com/Alpaca131/workers-kv-py.git`
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
workers-kv.py-1.2.1.tar.gz
(3.6 kB
view details)
File details
Details for the file workers-kv.py-1.2.1.tar.gz.
File metadata
- Download URL: workers-kv.py-1.2.1.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8652355a63ece95e326c078fbb0710825e6ad19a3b8439b86106b0bd92c19860
|
|
| MD5 |
000a31ab91e9dc17b27333fe1446f8d6
|
|
| BLAKE2b-256 |
f2ec143375d7b36d064e706d7f8d9597e2ce6300cbdbce5b95c096443d29a8c9
|