-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy path_client.py
More file actions
4510 lines (3189 loc) · 177 KB
/
_client.py
File metadata and controls
4510 lines (3189 loc) · 177 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from __future__ import annotations
import os
from typing import TYPE_CHECKING, Any, Mapping
from datetime import datetime
from typing_extensions import Self, override
import httpx
from . import _exceptions
from ._qs import Querystring
from ._types import (
Omit,
Headers,
Timeout,
NotGiven,
Transport,
ProxiesTypes,
RequestOptions,
not_given,
)
from ._utils import is_given, get_async_library
from ._compat import cached_property
from ._version import __version__
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
from ._exceptions import APIStatusError
from ._base_client import (
DEFAULT_MAX_RETRIES,
SyncAPIClient,
AsyncAPIClient,
)
if TYPE_CHECKING:
from .resources import (
ai,
d1,
kv,
r2,
acm,
dns,
iam,
ips,
rum,
ssl,
argo,
logs,
user,
web3,
cache,
calls,
fraud,
intel,
pages,
radar,
rules,
speed,
zaraz,
zones,
images,
queues,
stream,
billing,
filters,
logpush,
workers,
accounts,
aisearch,
alerting,
firewall,
rulesets,
snippets,
spectrum,
hostnames,
pipelines,
registrar,
turnstile,
vectorize,
workflows,
addressing,
ai_gateway,
audit_logs,
hyperdrive,
page_rules,
zero_trust,
api_gateway,
botnet_feed,
diagnostics,
memberships,
page_shield,
rate_limits,
url_scanner,
connectivity,
custom_pages,
dns_firewall,
healthchecks,
realtime_kit,
security_txt,
abuse_reports,
email_routing,
magic_transit,
organizations,
secrets_store,
waiting_rooms,
bot_management,
cloudforce_one,
dcv_delegation,
email_security,
load_balancers,
cloud_connector,
durable_objects,
r2_data_catalog,
request_tracers,
security_center,
brand_protection,
content_scanning,
custom_hostnames,
resource_sharing,
token_validation,
browser_rendering,
mtls_certificates,
schema_validation,
url_normalization,
custom_nameservers,
managed_transforms,
client_certificates,
custom_certificates,
keyless_certificates,
network_interconnects,
workers_for_platforms,
magic_cloud_networking,
origin_ca_certificates,
origin_tls_client_auth,
certificate_authorities,
leaked_credential_checks,
magic_network_monitoring,
origin_post_quantum_encryption,
)
from .resources.ips import IPsResource, AsyncIPsResource
from .resources.ai.ai import AIResource, AsyncAIResource
from .resources.d1.d1 import D1Resource, AsyncD1Resource
from .resources.fraud import FraudResource, AsyncFraudResource
from .resources.kv.kv import KVResource, AsyncKVResource
from .resources.r2.r2 import R2Resource, AsyncR2Resource
from .resources.acm.acm import ACMResource, AsyncACMResource
from .resources.dns.dns import DNSResource, AsyncDNSResource
from .resources.filters import FiltersResource, AsyncFiltersResource
from .resources.iam.iam import IAMResource, AsyncIAMResource
from .resources.rum.rum import RUMResource, AsyncRUMResource
from .resources.ssl.ssl import SSLResource, AsyncSSLResource
from .resources.argo.argo import ArgoResource, AsyncArgoResource
from .resources.logs.logs import LogsResource, AsyncLogsResource
from .resources.user.user import UserResource, AsyncUserResource
from .resources.web3.web3 import Web3Resource, AsyncWeb3Resource
from .resources.audit_logs import AuditLogsResource, AsyncAuditLogsResource
from .resources.page_rules import PageRulesResource, AsyncPageRulesResource
from .resources.cache.cache import CacheResource, AsyncCacheResource
from .resources.calls.calls import CallsResource, AsyncCallsResource
from .resources.intel.intel import IntelResource, AsyncIntelResource
from .resources.memberships import MembershipsResource, AsyncMembershipsResource
from .resources.pages.pages import PagesResource, AsyncPagesResource
from .resources.radar.radar import RadarResource, AsyncRadarResource
from .resources.rate_limits import RateLimitsResource, AsyncRateLimitsResource
from .resources.rules.rules import RulesResource, AsyncRulesResource
from .resources.speed.speed import SpeedResource, AsyncSpeedResource
from .resources.zaraz.zaraz import ZarazResource, AsyncZarazResource
from .resources.zones.zones import ZonesResource, AsyncZonesResource
from .resources.custom_pages import CustomPagesResource, AsyncCustomPagesResource
from .resources.security_txt import SecurityTXTResource, AsyncSecurityTXTResource
from .resources.images.images import ImagesResource, AsyncImagesResource
from .resources.queues.queues import QueuesResource, AsyncQueuesResource
from .resources.stream.stream import StreamResource, AsyncStreamResource
from .resources.bot_management import BotManagementResource, AsyncBotManagementResource
from .resources.dcv_delegation import DCVDelegationResource, AsyncDCVDelegationResource
from .resources.billing.billing import BillingResource, AsyncBillingResource
from .resources.logpush.logpush import LogpushResource, AsyncLogpushResource
from .resources.workers.workers import WorkersResource, AsyncWorkersResource
from .resources.accounts.accounts import AccountsResource, AsyncAccountsResource
from .resources.aisearch.aisearch import AISearchResource, AsyncAISearchResource
from .resources.alerting.alerting import AlertingResource, AsyncAlertingResource
from .resources.firewall.firewall import FirewallResource, AsyncFirewallResource
from .resources.rulesets.rulesets import RulesetsResource, AsyncRulesetsResource
from .resources.snippets.snippets import SnippetsResource, AsyncSnippetsResource
from .resources.spectrum.spectrum import SpectrumResource, AsyncSpectrumResource
from .resources.url_normalization import URLNormalizationResource, AsyncURLNormalizationResource
from .resources.custom_nameservers import CustomNameserversResource, AsyncCustomNameserversResource
from .resources.managed_transforms import ManagedTransformsResource, AsyncManagedTransformsResource
from .resources.client_certificates import ClientCertificatesResource, AsyncClientCertificatesResource
from .resources.hostnames.hostnames import HostnamesResource, AsyncHostnamesResource
from .resources.pipelines.pipelines import PipelinesResource, AsyncPipelinesResource
from .resources.registrar.registrar import RegistrarResource, AsyncRegistrarResource
from .resources.turnstile.turnstile import TurnstileResource, AsyncTurnstileResource
from .resources.vectorize.vectorize import VectorizeResource, AsyncVectorizeResource
from .resources.workflows.workflows import WorkflowsResource, AsyncWorkflowsResource
from .resources.keyless_certificates import KeylessCertificatesResource, AsyncKeylessCertificatesResource
from .resources.addressing.addressing import AddressingResource, AsyncAddressingResource
from .resources.ai_gateway.ai_gateway import AIGatewayResource, AsyncAIGatewayResource
from .resources.hyperdrive.hyperdrive import HyperdriveResource, AsyncHyperdriveResource
from .resources.zero_trust.zero_trust import ZeroTrustResource, AsyncZeroTrustResource
from .resources.origin_ca_certificates import OriginCACertificatesResource, AsyncOriginCACertificatesResource
from .resources.api_gateway.api_gateway import APIGatewayResource, AsyncAPIGatewayResource
from .resources.botnet_feed.botnet_feed import BotnetFeedResource, AsyncBotnetFeedResource
from .resources.diagnostics.diagnostics import DiagnosticsResource, AsyncDiagnosticsResource
from .resources.page_shield.page_shield import PageShieldResource, AsyncPageShieldResource
from .resources.url_scanner.url_scanner import URLScannerResource, AsyncURLScannerResource
from .resources.connectivity.connectivity import ConnectivityResource, AsyncConnectivityResource
from .resources.dns_firewall.dns_firewall import DNSFirewallResource, AsyncDNSFirewallResource
from .resources.healthchecks.healthchecks import HealthchecksResource, AsyncHealthchecksResource
from .resources.realtime_kit.realtime_kit import RealtimeKitResource, AsyncRealtimeKitResource
from .resources.abuse_reports.abuse_reports import AbuseReportsResource, AsyncAbuseReportsResource
from .resources.email_routing.email_routing import EmailRoutingResource, AsyncEmailRoutingResource
from .resources.magic_transit.magic_transit import MagicTransitResource, AsyncMagicTransitResource
from .resources.organizations.organizations import OrganizationsResource, AsyncOrganizationsResource
from .resources.secrets_store.secrets_store import SecretsStoreResource, AsyncSecretsStoreResource
from .resources.waiting_rooms.waiting_rooms import WaitingRoomsResource, AsyncWaitingRoomsResource
from .resources.cloudforce_one.cloudforce_one import CloudforceOneResource, AsyncCloudforceOneResource
from .resources.email_security.email_security import EmailSecurityResource, AsyncEmailSecurityResource
from .resources.load_balancers.load_balancers import LoadBalancersResource, AsyncLoadBalancersResource
from .resources.origin_post_quantum_encryption import (
OriginPostQuantumEncryptionResource,
AsyncOriginPostQuantumEncryptionResource,
)
from .resources.cloud_connector.cloud_connector import CloudConnectorResource, AsyncCloudConnectorResource
from .resources.durable_objects.durable_objects import DurableObjectsResource, AsyncDurableObjectsResource
from .resources.r2_data_catalog.r2_data_catalog import R2DataCatalogResource, AsyncR2DataCatalogResource
from .resources.request_tracers.request_tracers import RequestTracersResource, AsyncRequestTracersResource
from .resources.security_center.security_center import SecurityCenterResource, AsyncSecurityCenterResource
from .resources.brand_protection.brand_protection import BrandProtectionResource, AsyncBrandProtectionResource
from .resources.content_scanning.content_scanning import ContentScanningResource, AsyncContentScanningResource
from .resources.custom_hostnames.custom_hostnames import CustomHostnamesResource, AsyncCustomHostnamesResource
from .resources.resource_sharing.resource_sharing import ResourceSharingResource, AsyncResourceSharingResource
from .resources.token_validation.token_validation import TokenValidationResource, AsyncTokenValidationResource
from .resources.browser_rendering.browser_rendering import BrowserRenderingResource, AsyncBrowserRenderingResource
from .resources.mtls_certificates.mtls_certificates import MTLSCertificatesResource, AsyncMTLSCertificatesResource
from .resources.schema_validation.schema_validation import SchemaValidationResource, AsyncSchemaValidationResource
from .resources.custom_certificates.custom_certificates import (
CustomCertificatesResource,
AsyncCustomCertificatesResource,
)
from .resources.network_interconnects.network_interconnects import (
NetworkInterconnectsResource,
AsyncNetworkInterconnectsResource,
)
from .resources.workers_for_platforms.workers_for_platforms import (
WorkersForPlatformsResource,
AsyncWorkersForPlatformsResource,
)
from .resources.magic_cloud_networking.magic_cloud_networking import (
MagicCloudNetworkingResource,
AsyncMagicCloudNetworkingResource,
)
from .resources.origin_tls_client_auth.origin_tls_client_auth import (
OriginTLSClientAuthResource,
AsyncOriginTLSClientAuthResource,
)
from .resources.certificate_authorities.certificate_authorities import (
CertificateAuthoritiesResource,
AsyncCertificateAuthoritiesResource,
)
from .resources.leaked_credential_checks.leaked_credential_checks import (
LeakedCredentialChecksResource,
AsyncLeakedCredentialChecksResource,
)
from .resources.magic_network_monitoring.magic_network_monitoring import (
MagicNetworkMonitoringResource,
AsyncMagicNetworkMonitoringResource,
)
__all__ = [
"Timeout",
"Transport",
"ProxiesTypes",
"RequestOptions",
"Cloudflare",
"AsyncCloudflare",
"Client",
"AsyncClient",
]
class Cloudflare(SyncAPIClient):
# client options
api_token: str | None
api_key: str | None
api_email: str | None
user_service_key: str | None
def __init__(
self,
*,
api_token: str | None = None,
api_key: str | None = None,
api_email: str | None = None,
user_service_key: str | None = None,
base_url: str | httpx.URL | None = None,
api_version: str | None = None,
timeout: float | Timeout | None | NotGiven = not_given,
max_retries: int = DEFAULT_MAX_RETRIES,
default_headers: Mapping[str, str] | None = None,
default_query: Mapping[str, object] | None = None,
# Configure a custom httpx client.
# We provide a `DefaultHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`.
# See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details.
http_client: httpx.Client | None = None,
# Enable or disable schema validation for data returned by the API.
# When enabled an error APIResponseValidationError is raised
# if the API responds with invalid data for the expected schema.
#
# This parameter may be removed or changed in the future.
# If you rely on this feature, please open a GitHub issue
# outlining your use-case to help us decide if it should be
# part of our public interface in the future.
_strict_response_validation: bool = False,
) -> None:
"""Construct a new synchronous Cloudflare client instance.
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
- `api_token` from `CLOUDFLARE_API_TOKEN`
- `api_key` from `CLOUDFLARE_API_KEY`
- `api_email` from `CLOUDFLARE_EMAIL`
- `user_service_key` from `CLOUDFLARE_API_USER_SERVICE_KEY`
"""
if api_token is None:
api_token = os.environ.get("CLOUDFLARE_API_TOKEN")
self.api_token = api_token
if api_key is None:
api_key = os.environ.get("CLOUDFLARE_API_KEY")
self.api_key = api_key
if api_email is None:
api_email = os.environ.get("CLOUDFLARE_EMAIL")
self.api_email = api_email
if user_service_key is None:
user_service_key = os.environ.get("CLOUDFLARE_API_USER_SERVICE_KEY")
self.user_service_key = user_service_key
if base_url is None:
base_url = os.environ.get("CLOUDFLARE_BASE_URL")
if base_url is None:
base_url = f"https://api.cloudflare.com/client/v4"
if api_version is None:
api_version = datetime.today().strftime('%Y-%m-%d')
super().__init__(
version=__version__,
base_url=base_url,
api_version=api_version,
max_retries=max_retries,
timeout=timeout,
http_client=http_client,
custom_headers=default_headers,
custom_query=default_query,
_strict_response_validation=_strict_response_validation,
)
@cached_property
def accounts(self) -> AccountsResource:
from .resources.accounts import AccountsResource
return AccountsResource(self)
@cached_property
def organizations(self) -> OrganizationsResource:
from .resources.organizations import OrganizationsResource
return OrganizationsResource(self)
@cached_property
def origin_ca_certificates(self) -> OriginCACertificatesResource:
from .resources.origin_ca_certificates import OriginCACertificatesResource
return OriginCACertificatesResource(self)
@cached_property
def ips(self) -> IPsResource:
from .resources.ips import IPsResource
return IPsResource(self)
@cached_property
def memberships(self) -> MembershipsResource:
from .resources.memberships import MembershipsResource
return MembershipsResource(self)
@cached_property
def user(self) -> UserResource:
from .resources.user import UserResource
return UserResource(self)
@cached_property
def zones(self) -> ZonesResource:
from .resources.zones import ZonesResource
return ZonesResource(self)
@cached_property
def load_balancers(self) -> LoadBalancersResource:
from .resources.load_balancers import LoadBalancersResource
return LoadBalancersResource(self)
@cached_property
def cache(self) -> CacheResource:
from .resources.cache import CacheResource
return CacheResource(self)
@cached_property
def ssl(self) -> SSLResource:
from .resources.ssl import SSLResource
return SSLResource(self)
@cached_property
def acm(self) -> ACMResource:
from .resources.acm import ACMResource
return ACMResource(self)
@cached_property
def argo(self) -> ArgoResource:
from .resources.argo import ArgoResource
return ArgoResource(self)
@cached_property
def certificate_authorities(self) -> CertificateAuthoritiesResource:
from .resources.certificate_authorities import CertificateAuthoritiesResource
return CertificateAuthoritiesResource(self)
@cached_property
def client_certificates(self) -> ClientCertificatesResource:
from .resources.client_certificates import ClientCertificatesResource
return ClientCertificatesResource(self)
@cached_property
def custom_certificates(self) -> CustomCertificatesResource:
from .resources.custom_certificates import CustomCertificatesResource
return CustomCertificatesResource(self)
@cached_property
def custom_hostnames(self) -> CustomHostnamesResource:
from .resources.custom_hostnames import CustomHostnamesResource
return CustomHostnamesResource(self)
@cached_property
def custom_nameservers(self) -> CustomNameserversResource:
from .resources.custom_nameservers import CustomNameserversResource
return CustomNameserversResource(self)
@cached_property
def dns_firewall(self) -> DNSFirewallResource:
from .resources.dns_firewall import DNSFirewallResource
return DNSFirewallResource(self)
@cached_property
def dns(self) -> DNSResource:
from .resources.dns import DNSResource
return DNSResource(self)
@cached_property
def email_security(self) -> EmailSecurityResource:
from .resources.email_security import EmailSecurityResource
return EmailSecurityResource(self)
@cached_property
def email_routing(self) -> EmailRoutingResource:
from .resources.email_routing import EmailRoutingResource
return EmailRoutingResource(self)
@cached_property
def filters(self) -> FiltersResource:
from .resources.filters import FiltersResource
return FiltersResource(self)
@cached_property
def firewall(self) -> FirewallResource:
from .resources.firewall import FirewallResource
return FirewallResource(self)
@cached_property
def healthchecks(self) -> HealthchecksResource:
from .resources.healthchecks import HealthchecksResource
return HealthchecksResource(self)
@cached_property
def keyless_certificates(self) -> KeylessCertificatesResource:
from .resources.keyless_certificates import KeylessCertificatesResource
return KeylessCertificatesResource(self)
@cached_property
def logpush(self) -> LogpushResource:
from .resources.logpush import LogpushResource
return LogpushResource(self)
@cached_property
def logs(self) -> LogsResource:
from .resources.logs import LogsResource
return LogsResource(self)
@cached_property
def origin_tls_client_auth(self) -> OriginTLSClientAuthResource:
from .resources.origin_tls_client_auth import OriginTLSClientAuthResource
return OriginTLSClientAuthResource(self)
@cached_property
def page_rules(self) -> PageRulesResource:
from .resources.page_rules import PageRulesResource
return PageRulesResource(self)
@cached_property
def rate_limits(self) -> RateLimitsResource:
from .resources.rate_limits import RateLimitsResource
return RateLimitsResource(self)
@cached_property
def waiting_rooms(self) -> WaitingRoomsResource:
from .resources.waiting_rooms import WaitingRoomsResource
return WaitingRoomsResource(self)
@cached_property
def web3(self) -> Web3Resource:
from .resources.web3 import Web3Resource
return Web3Resource(self)
@cached_property
def workers(self) -> WorkersResource:
from .resources.workers import WorkersResource
return WorkersResource(self)
@cached_property
def kv(self) -> KVResource:
from .resources.kv import KVResource
return KVResource(self)
@cached_property
def durable_objects(self) -> DurableObjectsResource:
from .resources.durable_objects import DurableObjectsResource
return DurableObjectsResource(self)
@cached_property
def queues(self) -> QueuesResource:
from .resources.queues import QueuesResource
return QueuesResource(self)
@cached_property
def api_gateway(self) -> APIGatewayResource:
from .resources.api_gateway import APIGatewayResource
return APIGatewayResource(self)
@cached_property
def managed_transforms(self) -> ManagedTransformsResource:
from .resources.managed_transforms import ManagedTransformsResource
return ManagedTransformsResource(self)
@cached_property
def page_shield(self) -> PageShieldResource:
from .resources.page_shield import PageShieldResource
return PageShieldResource(self)
@cached_property
def rulesets(self) -> RulesetsResource:
from .resources.rulesets import RulesetsResource
return RulesetsResource(self)
@cached_property
def url_normalization(self) -> URLNormalizationResource:
from .resources.url_normalization import URLNormalizationResource
return URLNormalizationResource(self)
@cached_property
def spectrum(self) -> SpectrumResource:
from .resources.spectrum import SpectrumResource
return SpectrumResource(self)
@cached_property
def addressing(self) -> AddressingResource:
from .resources.addressing import AddressingResource
return AddressingResource(self)
@cached_property
def audit_logs(self) -> AuditLogsResource:
from .resources.audit_logs import AuditLogsResource
return AuditLogsResource(self)
@cached_property
def billing(self) -> BillingResource:
from .resources.billing import BillingResource
return BillingResource(self)
@cached_property
def brand_protection(self) -> BrandProtectionResource:
from .resources.brand_protection import BrandProtectionResource
return BrandProtectionResource(self)
@cached_property
def diagnostics(self) -> DiagnosticsResource:
from .resources.diagnostics import DiagnosticsResource
return DiagnosticsResource(self)
@cached_property
def images(self) -> ImagesResource:
from .resources.images import ImagesResource
return ImagesResource(self)
@cached_property
def intel(self) -> IntelResource:
from .resources.intel import IntelResource
return IntelResource(self)
@cached_property
def magic_transit(self) -> MagicTransitResource:
from .resources.magic_transit import MagicTransitResource
return MagicTransitResource(self)
@cached_property
def magic_network_monitoring(self) -> MagicNetworkMonitoringResource:
from .resources.magic_network_monitoring import MagicNetworkMonitoringResource
return MagicNetworkMonitoringResource(self)
@cached_property
def magic_cloud_networking(self) -> MagicCloudNetworkingResource:
from .resources.magic_cloud_networking import MagicCloudNetworkingResource
return MagicCloudNetworkingResource(self)
@cached_property
def network_interconnects(self) -> NetworkInterconnectsResource:
from .resources.network_interconnects import NetworkInterconnectsResource
return NetworkInterconnectsResource(self)
@cached_property
def mtls_certificates(self) -> MTLSCertificatesResource:
from .resources.mtls_certificates import MTLSCertificatesResource
return MTLSCertificatesResource(self)
@cached_property
def pages(self) -> PagesResource:
from .resources.pages import PagesResource
return PagesResource(self)
@cached_property
def registrar(self) -> RegistrarResource:
from .resources.registrar import RegistrarResource
return RegistrarResource(self)
@cached_property
def request_tracers(self) -> RequestTracersResource:
from .resources.request_tracers import RequestTracersResource
return RequestTracersResource(self)
@cached_property
def rules(self) -> RulesResource:
from .resources.rules import RulesResource
return RulesResource(self)
@cached_property
def stream(self) -> StreamResource:
from .resources.stream import StreamResource
return StreamResource(self)
@cached_property
def alerting(self) -> AlertingResource:
from .resources.alerting import AlertingResource
return AlertingResource(self)
@cached_property
def d1(self) -> D1Resource:
from .resources.d1 import D1Resource
return D1Resource(self)
@cached_property
def r2(self) -> R2Resource:
from .resources.r2 import R2Resource
return R2Resource(self)
@cached_property
def r2_data_catalog(self) -> R2DataCatalogResource:
from .resources.r2_data_catalog import R2DataCatalogResource
return R2DataCatalogResource(self)
@cached_property
def workers_for_platforms(self) -> WorkersForPlatformsResource:
from .resources.workers_for_platforms import WorkersForPlatformsResource
return WorkersForPlatformsResource(self)
@cached_property
def zero_trust(self) -> ZeroTrustResource:
from .resources.zero_trust import ZeroTrustResource
return ZeroTrustResource(self)
@cached_property
def turnstile(self) -> TurnstileResource:
from .resources.turnstile import TurnstileResource
return TurnstileResource(self)
@cached_property
def connectivity(self) -> ConnectivityResource:
from .resources.connectivity import ConnectivityResource
return ConnectivityResource(self)
@cached_property
def hyperdrive(self) -> HyperdriveResource:
from .resources.hyperdrive import HyperdriveResource
return HyperdriveResource(self)
@cached_property
def rum(self) -> RUMResource:
from .resources.rum import RUMResource
return RUMResource(self)
@cached_property
def vectorize(self) -> VectorizeResource:
from .resources.vectorize import VectorizeResource
return VectorizeResource(self)
@cached_property
def url_scanner(self) -> URLScannerResource:
from .resources.url_scanner import URLScannerResource
return URLScannerResource(self)
@cached_property
def radar(self) -> RadarResource:
from .resources.radar import RadarResource
return RadarResource(self)
@cached_property
def bot_management(self) -> BotManagementResource:
from .resources.bot_management import BotManagementResource
return BotManagementResource(self)
@cached_property
def fraud(self) -> FraudResource:
from .resources.fraud import FraudResource
return FraudResource(self)
@cached_property
def origin_post_quantum_encryption(self) -> OriginPostQuantumEncryptionResource:
from .resources.origin_post_quantum_encryption import OriginPostQuantumEncryptionResource
return OriginPostQuantumEncryptionResource(self)
@cached_property
def zaraz(self) -> ZarazResource:
from .resources.zaraz import ZarazResource
return ZarazResource(self)
@cached_property
def speed(self) -> SpeedResource:
from .resources.speed import SpeedResource
return SpeedResource(self)
@cached_property
def dcv_delegation(self) -> DCVDelegationResource:
from .resources.dcv_delegation import DCVDelegationResource
return DCVDelegationResource(self)
@cached_property
def hostnames(self) -> HostnamesResource:
from .resources.hostnames import HostnamesResource
return HostnamesResource(self)
@cached_property
def snippets(self) -> SnippetsResource:
from .resources.snippets import SnippetsResource
return SnippetsResource(self)
@cached_property
def realtime_kit(self) -> RealtimeKitResource:
from .resources.realtime_kit import RealtimeKitResource
return RealtimeKitResource(self)
@cached_property
def calls(self) -> CallsResource:
from .resources.calls import CallsResource
return CallsResource(self)
@cached_property
def cloudforce_one(self) -> CloudforceOneResource:
from .resources.cloudforce_one import CloudforceOneResource
return CloudforceOneResource(self)
@cached_property
def ai_gateway(self) -> AIGatewayResource:
from .resources.ai_gateway import AIGatewayResource
return AIGatewayResource(self)
@cached_property
def iam(self) -> IAMResource:
from .resources.iam import IAMResource
return IAMResource(self)
@cached_property
def cloud_connector(self) -> CloudConnectorResource:
from .resources.cloud_connector import CloudConnectorResource
return CloudConnectorResource(self)
@cached_property
def botnet_feed(self) -> BotnetFeedResource:
from .resources.botnet_feed import BotnetFeedResource
return BotnetFeedResource(self)
@cached_property
def security_txt(self) -> SecurityTXTResource:
from .resources.security_txt import SecurityTXTResource
return SecurityTXTResource(self)
@cached_property
def workflows(self) -> WorkflowsResource:
from .resources.workflows import WorkflowsResource
return WorkflowsResource(self)
@cached_property
def resource_sharing(self) -> ResourceSharingResource:
from .resources.resource_sharing import ResourceSharingResource
return ResourceSharingResource(self)
@cached_property
def leaked_credential_checks(self) -> LeakedCredentialChecksResource:
from .resources.leaked_credential_checks import LeakedCredentialChecksResource
return LeakedCredentialChecksResource(self)
@cached_property
def content_scanning(self) -> ContentScanningResource:
from .resources.content_scanning import ContentScanningResource
return ContentScanningResource(self)
@cached_property
def abuse_reports(self) -> AbuseReportsResource:
from .resources.abuse_reports import AbuseReportsResource
return AbuseReportsResource(self)
@cached_property
def ai(self) -> AIResource:
from .resources.ai import AIResource
return AIResource(self)
@cached_property
def aisearch(self) -> AISearchResource:
from .resources.aisearch import AISearchResource
return AISearchResource(self)
@cached_property
def security_center(self) -> SecurityCenterResource:
from .resources.security_center import SecurityCenterResource
return SecurityCenterResource(self)
@cached_property
def browser_rendering(self) -> BrowserRenderingResource:
from .resources.browser_rendering import BrowserRenderingResource
return BrowserRenderingResource(self)
@cached_property
def custom_pages(self) -> CustomPagesResource:
from .resources.custom_pages import CustomPagesResource
return CustomPagesResource(self)
@cached_property
def secrets_store(self) -> SecretsStoreResource:
from .resources.secrets_store import SecretsStoreResource
return SecretsStoreResource(self)
@cached_property
def pipelines(self) -> PipelinesResource:
from .resources.pipelines import PipelinesResource
return PipelinesResource(self)
@cached_property
def schema_validation(self) -> SchemaValidationResource:
from .resources.schema_validation import SchemaValidationResource
return SchemaValidationResource(self)
@cached_property
def token_validation(self) -> TokenValidationResource:
from .resources.token_validation import TokenValidationResource
return TokenValidationResource(self)
@cached_property
def with_raw_response(self) -> CloudflareWithRawResponse:
return CloudflareWithRawResponse(self)
@cached_property
def with_streaming_response(self) -> CloudflareWithStreamedResponse:
return CloudflareWithStreamedResponse(self)
@property
@override
def qs(self) -> Querystring:
return Querystring(nested_format="dots", array_format="repeat")
@property
@override
def auth_headers(self) -> dict[str, str]:
if self._api_email:
return self._api_email
if self._api_key:
return self._api_key
if self._api_token:
return self._api_token
if self._user_service_key:
return self._user_service_key
return {}
@property
def _api_email(self) -> dict[str, str]:
api_email = self.api_email