Skip to main content

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)

Setup

You will need to know your namespace id which is generated when you create a KV namespace and Account ID. To generate the KV api key follow the instructions below

  1. Navigate to Cloudflare API Tokens
  2. Create API Token
  3. Scroll down to create custom token
  4. Create a token with Workers KV Storage and select Edit

Example Token

You can use environment variables to store these the following are monitored

KV_NAMESPACE_ID="YOUR_NAMESPACE_ID"
CF_ACCOUNT_ID="YOUR_ACCOUNT_ID"
CF_API_KEY="YOUR_API_KEY"

Metadata

Release files for cfkv 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cfkv 1.1.2
File Size Uploaded Provenance Actions
cfkv-1.1.2.tar.gz 3.9 kB Without provenance Details for cfkv-1.1.2.tar.gz

Release files / cfkv-1.1.2.tar.gz

Download URL cfkv-1.1.2.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
bc53f40c0b74aaebf07a07ed49ea467477bfc772c92dabc794a159be71731e0a
BLAKE2b-256 checksum
How to use checksums
e75c7ff0f37c0d62c03324fb285298d4e7fd213a2b83f17928a52f594570117f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

Security for cfkv 1.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page