Skip to main content

A Pydantic BaseSettings class intended to be extended by other Cloudflare services.

Project description

start-cloudflare

Github CI

Small Pydantic settings helpers for Cloudflare projects.

start-cloudflare centralizes the environment variables and header helpers that Cloudflare API clients tend to repeat: account ID, API version, account email, legacy global API key, Origin CA key, bearer token headers, and account-scoped endpoint URLs.

Install

uv add start-cloudflare

Configure

Create a .env file or export the variables in your shell:

CF_ACCT_ID=your-account-id
CF_API_VERSION=4
CF_ACCT_EMAIL=you@example.com
CF_GLOBAL_API_KEY=legacy-global-api-key
CF_ORIGIN_CA_KEY=origin-ca-key

Only CF_ACCT_ID is normally needed for URL construction. Authentication values are optional until you request the matching header helper.

Use

from start_cloudflare import CF

cf = CF()

base_url = cf.base
account_url = cf.add_account_endpoint("/zones")
auth_header = CF.set_bearer_auth("api-token")

For a default configuration, base_url is https://api.cloudflare.com/client/v4, and account_url is https://api.cloudflare.com/client/v4/accounts/zones.

Documentation

See the full documentation for field details, examples, and generated API reference.

Development

uv sync
uv run pytest
uv run zensical build

To preview the docs locally:

just docs

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

start_cloudflare-0.0.9.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

start_cloudflare-0.0.9-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file start_cloudflare-0.0.9.tar.gz.

File metadata

  • Download URL: start_cloudflare-0.0.9.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for start_cloudflare-0.0.9.tar.gz
Algorithm Hash digest
SHA256 b9ccca775df379762c04decd6b8a3cd562e2c649b6e497cfc87e6d80ae019a7d
MD5 9dcbf2242f10114a0b07cd80754f17db
BLAKE2b-256 dec8afa9455460d86bec6a64c965c46f41da5b467376d99429938ed1b7e3e8d2

See more details on using hashes here.

File details

Details for the file start_cloudflare-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: start_cloudflare-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for start_cloudflare-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 c6ab1f2934e8043a362ad5e3f485acd1f80842e259c6b81b486d1bcf583a475a
MD5 173e4611c3c9edba24fea434fbb70feb
BLAKE2b-256 0bcc06ac017ee3831cb64f133cca1a2852f3a9eb7ba9c108daad89a12c7106a5

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