--- id: cloudflare version: "5.6.0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # cloudflare — The official Python library for the cloudflare API License: permissive · Maintenance: active · Downloads: 10.1M/mo ## What it is and what it does This is the official Python client for the Cloudflare REST API, generated using Stainless. It wraps Cloudflare's full API surface—zones, accounts, DNS records, KV storage, and more—in a typed, modern Python interface. The library ships with both synchronous and asynchronous clients powered by httpx, and includes full type definitions for request parameters and response objects using Pydantic models and TypedDicts. The client handles pagination automatically, error classification (connection errors, rate limits, authentication failures, and HTTP status codes), and retries certain transient failures by default. It supports file uploads, nested parameters, and provides helper methods on response objects for serialization. You can optionally swap the HTTP backend to aiohttp for improved async concurrency. The library targets Python 3.9+ and is actively maintained. Use it for: - Manage DNS records, zones, and accounts programmatically for multi-tenant or infrastructure-as-code workflows. - Build async applications that interact with Cloudflare's KV storage, Workers, or other edge services. - Automate SSL/TLS certificate provisioning, firewall rules, or DDoS protection settings. - Integrate Cloudflare API calls into monitoring or observability platforms with typed, autocomplete-friendly code. - Paginate through large lists of accounts, zones, or DNS records without manual page handling. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a Python client library for the Cloudflare REST API with both synchronous and asynchronous interfaces, full type hints, and automatic pagination support. Yes. This is the official, actively maintained Cloudflare Python client with low install friction, no known vulnerabilities, permissive licensing, and strong type support. Install it if you need to interact with Cloudflare's API from Python—it is the canonical choice for this task. ## Install pip install cloudflare uv add cloudflare poetry add cloudflare ## Installing cloudflare Before you install: Low install friction with a pure-Python wheel. Actively maintained with a recent release (23 days old) and 494 repository stars. Supports current Python versions (3.9+) and has no known vulnerabilities. License in practice: Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions beyond attribution and liability disclaimers. Quickstart: pip install cloudflare import os from cloudflare import Cloudflare client = Cloudflare(api_token=os.environ.get("CLOUDFLARE_API_TOKEN")) zone = client.zones.create( account={"id": "023e105f4ecef8ad9ca31a8372d0c353"}, name="example.com", type="full", ) print(zone.id) Requires Python 3.9 or later and a valid Cloudflare API token (typically provided via environment variable). Verify before relying: - Rate limit handling and retry behavior beyond the documented default 2 retries with exponential backoff. - Performance characteristics of the async client with aiohttp versus httpx under high concurrency. - Completeness of API coverage relative to the full Cloudflare REST API surface. ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 10.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags cloudflare api client, cloudflare python sdk, dns management python, cdn api python, cloudflare zones management, async cloudflare client, typed cloudflare api, cloudflare-api, async-http-client, typed-sdk [View on SkillFed](https://skillfed.io/packages/cloudflare) · [View on PyPI](https://pypi.org/project/cloudflare/)