The official Python library for interacting with the Cloudflare API. It provides a comprehensive client for accessing various Cloudflare services. The current stable version is 4.3.1. The library follows a frequent release cadence, often introducing new features and occasionally breaking changes due to underlying API updates.
pip install cloudflareVerified import paths — ran on the pinned version, not inferred.
This quickstart initializes the Cloudflare client using an API Token from an environment variable and then lists your Cloudflare zones. It demonstrates basic API interaction and error handling.
Review the official changelog for v5.0.0 when it is released. Be prepared for extensive updates to API call paths, request/response models, and potentially authentication methods. Consider pinning your dependency to `<5.0.0` until you are ready to migrate.
If upgrading from <4.0.0, update code interacting with `addressing` endpoints or the `jurisdiction` parameter in R2 to reflect the new structure and parameter names as per the official documentation.
If migrating from 2.x, expect a complete overhaul of your Cloudflare API calls. Pin your dependency to `cloudflare<3.0.0` if you need stability with the older API, or thoroughly review the 3.x/4.x changelogs for the new structure.
For API Tokens, use `Cloudflare.Cloudflare(token='YOUR_API_TOKEN')`. For Global API Keys, use `Cloudflare.Cloudflare(email='your_email@example.com', token='YOUR_GLOBAL_API_KEY')`. Ensure the API Token has the necessary permissions for the calls you are making.
Ensure the Cloudflare library is installed in your Python environment by running `pip install cloudflare`. If using a virtual environment, ensure it is activated before running your script.
Ensure the `cloudflare` package is installed in your Python environment using `pip install cloudflare`. Verify that your `import` statement uses the correct module name, typically `Cloudflare` for this library.
No dependency data recorded yet.