cloudflare/cloudflare-python v5.2.0
cloudflare/cloudflare-python
Captured source
source ↗v5.2.0
Repository: cloudflare/cloudflare-python
Tag: v5.2.0
Published: 2026-05-21T22:31:17Z
Prerelease: no
Release notes:
5.2.0 (2026-05-21)
Full Changelog: v5.1.0...v5.2.0
Breaking Changes
Cache - Origin Cloud Regions Reworked
The cache.origin_cloud_regions resource has been significantly reworked. Endpoints changed from /zones/{zone_id}/cache/origin_cloud_regions to /zones/{zone_id}/origin/cloud_regions, several methods were removed or renamed, and return types were consolidated.
Removed methods:
create-- replaced byupdate(PUT single item)edit-- removed (useupdateinstead)bulk_edit-- renamed tobulk_update
Changed return types:
listnow returnsSyncV4PagePaginationArray[OriginCloudRegion](wasOptional[OriginCloudRegionListResponse])getnow returnsOptional[OriginCloudRegion](wasOptional[OriginCloudRegionGetResponse])
Removed types:
OriginCloudRegionCreateResponseOriginCloudRegionListResponseOriginCloudRegionBulkEditResponseOriginCloudRegionEditResponseOriginCloudRegionGetResponse
New types:
from cloudflare.types.cache import ( OriginCloudRegion, OriginCloudRegionBulkUpdateResponse, )
API Gateway - Discovery Operation Edit Removed
The api_gateway.discovery.operations.edit method and its associated OperationEditResponse type have been removed. Use bulk_edit instead.
Features
- ddos_protection: add new DDoS Protection service (87f7e95)
- ai_security: add new AI Security service (29cb585)
- ai_gateway: add billing sub-resource with credit balance, invoices, usage history, topup, and spending limit (4923bbb)
- r2: add bucket objects sub-resource with list, delete, get, and upload (72d2149)
- zero_trust: add access SAML certificates, identity provider SAML certificate, and resource library (aeff7d5)
- load_balancers: add monitor group references sub-resource (bb6815d)
- radar: add BGP IPs top ASes and RPKI ROAs timeseries (fb2f0c4)
- cache: add
purge_environmentmethod andsmart_tiered_cache.createmethod (b7ae845) - workers: add
secrets.bulk_updatemethod (0bdb685) - workers_for_platforms: add
secrets.bulk_updatemethod (7bfed3c) - secrets_store:
stores.deletenow accepts optional params (636414f) - ai_gateway:
dynamic_routing.listnow accepts optional params (4923bbb)
DDoS Protection (NEW SERVICE)
New top-level service at client.ddos_protection for managing Advanced TCP Protection configurations including allowlists, prefixes, SYN protection (filters and rules), TCP flow protection (filters and rules), and protection status.
from cloudflare.types.ddos_protection.advanced_tcp_protection import ( AllowlistCreateResponse, AllowlistListResponse, PrefixCreateResponse, PrefixListResponse, StatusEditResponse, StatusGetResponse, )
Key methods:
ddos_protection.advanced_tcp_protection.allowlist.create/list/bulk_deleteddos_protection.advanced_tcp_protection.prefixes.create/list/bulk_create/bulk_deleteddos_protection.advanced_tcp_protection.syn_protection.filters.create/list/bulk_deleteddos_protection.advanced_tcp_protection.syn_protection.rules.create/list/bulk_deleteddos_protection.advanced_tcp_protection.tcp_flow_protection.filters.create/list/bulk_deleteddos_protection.advanced_tcp_protection.tcp_flow_protection.rules.create/list/bulk_deleteddos_protection.advanced_tcp_protection.status.edit/get
Each collection also has an .items sub-resource for individual item delete, edit, and get operations.
AI Security (NEW SERVICE)
New top-level service at client.ai_security for managing zone-level AI security settings and custom topics.
from cloudflare.types.ai_security import ( AISecurityUpdateResponse, AISecurityGetResponse, CustomTopicUpdateResponse, CustomTopicGetResponse, )
Methods:
ai_security.update/get-- manage AI security settings for a zoneai_security.custom_topics.update/get-- manage custom topics
AI Gateway - Billing
New client.ai_gateway.billing sub-resource with credit balance, invoice history/preview, usage history, topup management, and spending limits.
from cloudflare.types.ai_gateway import ( BillingCreditBalanceResponse, BillingInvoiceHistoryResponse, BillingInvoicePreviewResponse, BillingUsageHistoryResponse, ) from cloudflare.types.ai_gateway.billing import ( TopupCreateResponse, TopupStatusResponse, SpendingLimitGetResponse, ) from cloudflare.types.ai_gateway.billing.topup import ( ConfigCreateResponse, ConfigGetResponse, )
R2 - Bucket Objects
New client.r2.buckets.objects sub-resource for managing objects within R2 buckets.
from cloudflare.types.r2.buckets import ( ObjectListResponse, ObjectDeleteResponse, ObjectUploadResponse, )
Methods:
r2.buckets.objects.list-- list objects in a bucket (cursor-paginated)r2.buckets.objects.delete-- delete an objectr2.buckets.objects.get-- download an object (returnsBinaryAPIResponse)r2.buckets.objects.upload-- upload an object
Zero Trust - SAML Certificates and Resource Library
New sub-resources:
**Access SAML…
Excerpt shown — open the source for the full document.
Notability
notability 1.0/10Routine library release, not AI related