Skip to main content

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 details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

workers_kv.py-1.2.2-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

workers_kv.py-1.2.2-py2.py3-none-any.whl (5.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file workers-kv.py-1.2.2.tar.gz.

File metadata

  • Download URL: workers-kv.py-1.2.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for workers-kv.py-1.2.2.tar.gz
Algorithm Hash digest
SHA256 f2f4df0719ef77262066a5bfb93960ede11a2d390218adb7692b23209915de3d
MD5 ec1d1963537adbd6f71fa23fb1819603
BLAKE2b-256 9accbe7f9e962716379724c74789034cc3fbb8ec6000d9ad9311cbcd05f61a53

See more details on using hashes here.

File details

Details for the file workers_kv.py-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: workers_kv.py-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for workers_kv.py-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e351e80e3c1afa9bb3d3fa9d194ef55fdb5bdc25e794771bc22d1081580a3fde
MD5 4f1c7011221c3718bb04b6d1c65d4327
BLAKE2b-256 5c92810cfc753c6d36bb4c2adadca5768841c67e3880096c88b79e860ae10565

See more details on using hashes here.

File details

Details for the file workers_kv.py-1.2.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for workers_kv.py-1.2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e13a34c9d0d6960bb99083dc6b76a12a7876c5755dbd04b44b8456b23a3edbda
MD5 519055e88865ff3452b29f7e1fb05892
BLAKE2b-256 77f991298ce961d0687f60ff899bf97bf72dfe058bd9cd956fba53773c021887

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page