cloudflare-python  by cloudflare

Python SDK for Cloudflare API

Created 2 years ago
403 stars

Top 72.1% on SourcePulse

GitHubView on GitHub
Project Summary

This Python library provides a convenient interface to the Cloudflare REST API, enabling Python 3.9+ applications to programmatically manage Cloudflare services. It offers both synchronous and asynchronous clients, catering to diverse application needs and simplifying integration with Cloudflare's extensive features for developers and power users.

How It Works

The library leverages httpx for its core HTTP communication, supporting both synchronous and asynchronous operations. It is generated using Stainless, ensuring consistency with the Cloudflare API. Request parameters are typed using TypedDict, and responses are Pydantic models, enhancing type safety, autocompletion, and early bug detection within IDEs. This approach facilitates robust and maintainable integrations.

Quick Start & Requirements

  • Installation: pip install --pre cloudflare
  • Prerequisites: Python 3.9 or higher. Authentication typically requires setting environment variables like CLOUDFLARE_API_TOKEN.
  • Documentation: REST API documentation is available at developers.cloudflare.com, with the library's specific API detailed in api.md.

Highlighted Details

  • Features both synchronous and asynchronous clients, with an option to use aiohttp for enhanced async performance.
  • Provides type-safe requests and responses using TypedDict and Pydantic models.
  • Includes auto-paginating iterators for efficient handling of list endpoints.
  • Offers granular control over retries, timeouts, and error handling, with specific exception types for API-related issues.
  • Supports streaming responses and making custom or undocumented API requests.

Maintenance & Community

No specific details regarding maintainers, community channels (like Discord/Slack), or roadmap were found in the provided README excerpt.

Licensing & Compatibility

The README does not explicitly state a license. Standard open-source compatibility for commercial use is generally assumed unless otherwise specified.

Limitations & Caveats

The library notes that in API responses, a field being None can signify either an explicit null value or a missing key, which can be differentiated using .model_fields_set. No other limitations or alpha statuses were mentioned.

Health Check
Last Commit

1 day ago

Responsiveness

Inactive

Pull Requests (30d)
2
Issues (30d)
0
Star History
17 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.