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.2.tar.gz
(4.0 kB
view hashes)
Built Distributions
Close
Hashes for workers_kv.py-1.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e351e80e3c1afa9bb3d3fa9d194ef55fdb5bdc25e794771bc22d1081580a3fde |
|
MD5 | 4f1c7011221c3718bb04b6d1c65d4327 |
|
BLAKE2b-256 | 5c92810cfc753c6d36bb4c2adadca5768841c67e3880096c88b79e860ae10565 |
Close
Hashes for workers_kv.py-1.2.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e13a34c9d0d6960bb99083dc6b76a12a7876c5755dbd04b44b8456b23a3edbda |
|
MD5 | 519055e88865ff3452b29f7e1fb05892 |
|
BLAKE2b-256 | 77f991298ce961d0687f60ff899bf97bf72dfe058bd9cd956fba53773c021887 |