A Python wrapper for the Cloudflare KV Cache API
Project description
CFKV
A simple wrapper to communicate with Cloudflare KV Store . It can be used as a cache and features will be implemented to be used in frameworks such as FastAPI
- Set and Get
- Fastapi Middleware
- Flask integration
- Options to include string instead of dict entry
Simple Usage
import datetime
from cfkv import KVStore
store = KVStore(namespace_id="YOUR_NAMESPACE_ID", account_id="ACCOUNT_ID", api_key="API_KEY")
# Usage Example
key = "sample_key"
get = store.get(key)
if get is None:
data = {"test": True, "date": str(datetime.datetime.now())}
store.set(key)
data['stored'] = False
get = data
else:
data['stored'] = True
print(get)
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
cfkv-1.0.3.tar.gz
(1.9 kB
view details)
File details
Details for the file cfkv-1.0.3.tar.gz
.
File metadata
- Download URL: cfkv-1.0.3.tar.gz
- Upload date:
- Size: 1.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e10cfd49ba32e39447f7ede4cc2c9760af7687869fa582ec00676cdfb2f9f80c |
|
MD5 | 215e337e7c68336aad53b8007b72fa1d |
|
BLAKE2b-256 | 535441eb2ac082cde3fc6fbb1e94e8b0d51c4ecd668f3698a767f3e2d2204969 |