Skip to main content

A Python wrapper for the Cloudflare KV Cache API

Project description

CFKV

Deploy > PYPI > Test

Release

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.1.0.tar.gz (2.9 kB view details)

Uploaded Source

File details

Details for the file cfkv-1.1.0.tar.gz.

File metadata

  • Download URL: cfkv-1.1.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for cfkv-1.1.0.tar.gz
Algorithm Hash digest
SHA256 10227a43987a6cec4c86f1e7522e911e742efbf1d214379a7ec9d56f4738614e
MD5 4cc11d0c70197da5f3f7d64d130f901b
BLAKE2b-256 436d3b72fae4e6a220d916d0067ab8c551c67a56e5bf7e0d5bb96ca3ad26baaf

See more details on using hashes here.

Supported by

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