diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2426e86d82..fbaebd5dcf0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,12 +2,12 @@ name: CI on: push: - branches: - - main - pull_request: - branches: - - main - - next + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'stl-preview-head/**' + - 'stl-preview-base/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -15,10 +15,9 @@ concurrency: jobs: lint: + timeout-minutes: 10 name: lint - runs-on: ubuntu-latest - timeout-minutes: 5 - + runs-on: ${{ github.repository == 'stainless-sdks/cloudflare-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 @@ -36,11 +35,34 @@ jobs: - name: Run lints run: ./scripts/lint + upload: + if: github.repository == 'stainless-sdks/cloudflare-python' + timeout-minutes: 10 + name: upload + permissions: + contents: read + id-token: write + runs-on: depot-ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + + - name: Get GitHub OIDC Token + id: github-oidc + uses: actions/github-script@v6 + with: + script: core.setOutput('github_token', await core.getIDToken()); + + - name: Upload tarball + env: + URL: https://pkg.stainless.com/s + AUTH: ${{ steps.github-oidc.outputs.github_token }} + SHA: ${{ github.sha }} + run: ./scripts/utils/upload-artifact.sh + test: + timeout-minutes: 10 name: test - runs-on: ubuntu-latest - timeout-minutes: 30 - + runs-on: ${{ github.repository == 'stainless-sdks/cloudflare-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 @@ -59,9 +81,10 @@ jobs: run: ./scripts/test examples: + timeout-minutes: 10 name: examples - runs-on: ubuntu-latest - timeout-minutes: 5 + runs-on: ${{ github.repository == 'stainless-sdks/cloudflare-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: github.repository == 'cloudflare/cloudflare-python' steps: - uses: actions/checkout@v4 diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3b4c2d4ba94..bd7f384477c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.1.0" + ".": "4.2.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 025f3a2867d..51ae6c05c72 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,4 @@ -configured_endpoints: 1655 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-0ed9f898b31619623e50d660d04beca50e44987bfd3eb3a6ff98d3bca2a9c569.yml +configured_endpoints: 1739 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-21fbf04b9222bd0059426c105b24c16b4775d5595c651a04e63fb78a1a686fab.yml +openapi_spec_hash: f8d6920ea1ae1d014bf07d744a3c07cf +config_hash: 832d410720874fa45f75366ae536db6c diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c1c116b532..fc515f5749d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,88 @@ # Changelog +## 4.2.0 (2025-05-16) + +Full Changelog: [v4.1.0...v4.2.0](https://github.com/cloudflare/cloudflare-python/compare/v4.1.0...v4.2.0) + +### Features + +* **access_settings:** add CRUD support ([5c405ce](https://github.com/cloudflare/cloudflare-python/commit/5c405cef8664b45d6d85b3676db276e5712469b9)) +* **api:** api update ([26e2711](https://github.com/cloudflare/cloudflare-python/commit/26e271148bea672aae2424afa34d1bbe05d5586b)) +* **api:** api update ([91316ee](https://github.com/cloudflare/cloudflare-python/commit/91316eea8a9d0a4780c65ad1680de3f357113d62)) +* **api:** api update ([bc7133d](https://github.com/cloudflare/cloudflare-python/commit/bc7133dd7f5fe6845d885e7e6727bfe6682ea441)) +* **api:** api update ([bb4bd21](https://github.com/cloudflare/cloudflare-python/commit/bb4bd218a1ae33d9dc4aea68975570a9c4255db0)) +* **api:** api update ([2914707](https://github.com/cloudflare/cloudflare-python/commit/29147073fa048ad2758fb72f6190ef8b7cb0b7e7)) +* **api:** api update ([03e79c1](https://github.com/cloudflare/cloudflare-python/commit/03e79c10da77b35afe7915ccb9eb560339841cae)) +* **api:** api update ([edfddf3](https://github.com/cloudflare/cloudflare-python/commit/edfddf31cf1cbc233e90341c3786bbcd873a72ea)) +* **api:** api update ([be32215](https://github.com/cloudflare/cloudflare-python/commit/be32215fc9f229ae6f61ab072bb4ebb3de4109f7)) +* **api:** api update ([5901900](https://github.com/cloudflare/cloudflare-python/commit/59019001da4fe85b326000e37df0e5cb61375945)) +* **api:** api update ([ba166b3](https://github.com/cloudflare/cloudflare-python/commit/ba166b369840ade49924dff938115976e3867a5c)) +* **api:** api update ([d487232](https://github.com/cloudflare/cloudflare-python/commit/d487232e264c310345b3ea85822e550af252c0a4)) +* **api:** api update ([17cb705](https://github.com/cloudflare/cloudflare-python/commit/17cb705744d081357d5f9c418ec3dfb45df60110)) +* **api:** api update ([5ad6267](https://github.com/cloudflare/cloudflare-python/commit/5ad6267fc27d8b5bdba1b5dc570528517ab58b9f)) +* **api:** api update ([f5d07b9](https://github.com/cloudflare/cloudflare-python/commit/f5d07b9dc10febfd488f5955b750820681b6ca33)) +* **api:** api update ([ef764d4](https://github.com/cloudflare/cloudflare-python/commit/ef764d481e5d0f305e887218feb8ccbcdfe2d220)) +* **api:** api update ([f381a98](https://github.com/cloudflare/cloudflare-python/commit/f381a9801f7adedb2738da815b891db8dcd3d26a)) +* **api:** api update ([a45728a](https://github.com/cloudflare/cloudflare-python/commit/a45728adfa9f6048f93f97fe99c63fae8e2847d3)) +* **api:** api update ([4f2fe11](https://github.com/cloudflare/cloudflare-python/commit/4f2fe11cd2be909af128e9d1d8278a96ff4a9456)) +* **api:** api update ([7e458e7](https://github.com/cloudflare/cloudflare-python/commit/7e458e7669fb07b0987b7253ef7e010a52164e90)) +* **api:** api update ([07074f1](https://github.com/cloudflare/cloudflare-python/commit/07074f15880e4ad944381ee7556740d34cb4de4d)) +* **api:** api update ([04834e7](https://github.com/cloudflare/cloudflare-python/commit/04834e7b5f2c48f81df53ae502d57de5846b2fd0)) +* **api:** api update ([ecc0b17](https://github.com/cloudflare/cloudflare-python/commit/ecc0b17e46459f45715591ab8a9c42fa53f58ae5)) +* **api:** api update ([6750cf3](https://github.com/cloudflare/cloudflare-python/commit/6750cf364f95deae9cbfcf7755a5f470d11d82fb)) +* **api:** api update ([0b00d97](https://github.com/cloudflare/cloudflare-python/commit/0b00d971c8df169d5c3985a70bd05f345339adea)) +* **api:** api update ([0e950d6](https://github.com/cloudflare/cloudflare-python/commit/0e950d65a750fb3741d8728c980e804d658c0306)) +* **api:** api update ([23d7f1c](https://github.com/cloudflare/cloudflare-python/commit/23d7f1ca8fda9c31fb1a5ce80ca815d01752e3d7)) +* **api:** api update ([0c6f4a1](https://github.com/cloudflare/cloudflare-python/commit/0c6f4a1c252af1b1da345bea53d0d85939950b23)) +* **api:** api update ([20295df](https://github.com/cloudflare/cloudflare-python/commit/20295df8880c0b22da4ba89d845fcb3d99490021)) +* **api:** api update ([ba2b47a](https://github.com/cloudflare/cloudflare-python/commit/ba2b47ac123e37d4043fe2d74a510ad3202bac7f)) +* **api:** api update ([676ac08](https://github.com/cloudflare/cloudflare-python/commit/676ac089f6b52fc9d26785684e88b74ae74dceb9)) +* **api:** api update ([9ca549e](https://github.com/cloudflare/cloudflare-python/commit/9ca549e242e8e5f537b951c4c24189491928e9f4)) +* **api:** api update ([71efbfa](https://github.com/cloudflare/cloudflare-python/commit/71efbfaf56891305d123d4078f48101fb0c608fe)) +* **api:** api update ([af68ef6](https://github.com/cloudflare/cloudflare-python/commit/af68ef6ac477d9305391318ea5e033f6e111c00e)) +* **api:** api update ([e749879](https://github.com/cloudflare/cloudflare-python/commit/e749879ab0abb0e2383c07efb2f0f546682d9ce7)) +* **api:** api update ([b2cfa5d](https://github.com/cloudflare/cloudflare-python/commit/b2cfa5d06466c1a5903d4b159828abdc36b3d0e9)) +* **api:** api update ([d61b25a](https://github.com/cloudflare/cloudflare-python/commit/d61b25a7e26214012fe5ba727f61a2d877bca5b6)) +* **api:** api update ([5cbdb5e](https://github.com/cloudflare/cloudflare-python/commit/5cbdb5e773b35acf782cfd9dce7a9e329a76e3fa)) +* **api:** api update ([563ea64](https://github.com/cloudflare/cloudflare-python/commit/563ea64e06093ecd8067b9b19b76cd0e0b2f3e0a)) +* **api:** api update ([be46746](https://github.com/cloudflare/cloudflare-python/commit/be4674648edd2531fe08164f8367ac63ee385f7e)) +* **api:** api update ([6834a83](https://github.com/cloudflare/cloudflare-python/commit/6834a831237c3031f51387e06881c23e41343dd6)) +* **api:** api update ([e9809cf](https://github.com/cloudflare/cloudflare-python/commit/e9809cfbae5a4d4217a40739e2d15551d8fa872d)) +* **api:** api update ([fff82c3](https://github.com/cloudflare/cloudflare-python/commit/fff82c307f3da3f65131679f6ae9de77289fe954)) +* **api:** api update ([885373e](https://github.com/cloudflare/cloudflare-python/commit/885373e61028d0368bf3fb963f7afa0cdbe9c6ee)) +* **api:** api update ([7d76f9d](https://github.com/cloudflare/cloudflare-python/commit/7d76f9d101f9a8e9d7c6951fcdad2b6e72a8a614)) +* **api:** manual updates ([6fa22ed](https://github.com/cloudflare/cloudflare-python/commit/6fa22edc2ef43217056a5b0675753cb2341554aa)) +* **api:** manual updates ([e4d4ff5](https://github.com/cloudflare/cloudflare-python/commit/e4d4ff5267aade48da6bddfece3b6d52fb473c26)) +* **api:** update path placeholders ([d2d1c24](https://github.com/cloudflare/cloudflare-python/commit/d2d1c246d0c650e565057f1b98c40054aa693f12)) +* **device_settings:** swap list to get endpoint ([977d5c7](https://github.com/cloudflare/cloudflare-python/commit/977d5c72013c3c55bc235512ec619f90efa7bfc2)) +* **schema_validation:** add mapped endpoints ([7b3a51b](https://github.com/cloudflare/cloudflare-python/commit/7b3a51bc157feccbaee5b22dff61469849bcbf3f)) +* **threat_events:** add list support ([4beeff9](https://github.com/cloudflare/cloudflare-python/commit/4beeff9c87058ce7cb972b2f3826d127775d21eb)) + + +### Bug Fixes + +* **api:** fix path placeholders ([c8a0db8](https://github.com/cloudflare/cloudflare-python/commit/c8a0db8796322dc391619b9a76c8ce3f551eba2a)) +* **client:** fix bug in Python SDK when subresource has the same name as its parent ([c18a098](https://github.com/cloudflare/cloudflare-python/commit/c18a098640fd597a1fc12db31b40b923dc89101a)) +* **package:** support direct resource imports ([7e46269](https://github.com/cloudflare/cloudflare-python/commit/7e4626961b5c2a425cdee53a2062dcc1fe14f7cd)) +* **pydantic v1:** more robust ModelField.annotation check ([012add4](https://github.com/cloudflare/cloudflare-python/commit/012add4d67ec2fbb2b743ff4cec3297b0077ec2d)) +* **urlscanner:** don't unwwrap scan response ([5fe7ea9](https://github.com/cloudflare/cloudflare-python/commit/5fe7ea9b5b31ace57ed670a65c4b276fba5eee18)) + + +### Chores + +* broadly detect json family of content-type headers ([1c2fb5a](https://github.com/cloudflare/cloudflare-python/commit/1c2fb5a49f8efc69902f0a3dd447b9c911334b6b)) +* **ci:** add timeout thresholds for CI jobs ([b38f0ac](https://github.com/cloudflare/cloudflare-python/commit/b38f0ace9ae9a04890c306198335fc44a403d1a3)) +* **ci:** fix installation instructions ([a9bc47f](https://github.com/cloudflare/cloudflare-python/commit/a9bc47fb44bcaf750eb579c327f6a86bf18c6395)) +* **ci:** only use depot for staging repos ([8fea9cb](https://github.com/cloudflare/cloudflare-python/commit/8fea9cb064f975e3cabb5f5f8b77c9528fdad40b)) +* **ci:** run on more branches and use depot runners ([67ee23a](https://github.com/cloudflare/cloudflare-python/commit/67ee23a7ac47ea2392068c99a4196b866344bd29)) +* **ci:** upload sdks to package manager ([c8af26d](https://github.com/cloudflare/cloudflare-python/commit/c8af26d72d6e0c48acdd9518c42fbfb28809dd45)) +* **internal:** avoid errors for isinstance checks on proxies ([7b734a1](https://github.com/cloudflare/cloudflare-python/commit/7b734a186d2ca69066a75956fcc47ccbe02df0b1)) +* **internal:** codegen related update ([b1fdd11](https://github.com/cloudflare/cloudflare-python/commit/b1fdd1187e9179cb3fd7c92779140d9b6bdc08fd)) +* **internal:** fix list file params ([128fbe6](https://github.com/cloudflare/cloudflare-python/commit/128fbe63aa61e7c7e8834d00cf96135c7cc8a438)) +* **internal:** import reformatting ([af978d0](https://github.com/cloudflare/cloudflare-python/commit/af978d029886113c779ad80865bfa320d82b9a7b)) +* **internal:** minor formatting changes ([8ca04ea](https://github.com/cloudflare/cloudflare-python/commit/8ca04ea4ae308de10743146ec8c6ba89e2916004)) +* **internal:** refactor retries to not use recursion ([baedf67](https://github.com/cloudflare/cloudflare-python/commit/baedf673e48f103406cd609410a71e139efef5d7)) + ## 4.1.0 (2025-03-18) Full Changelog: [v4.0.0...v4.1.0](https://github.com/cloudflare/cloudflare-python/compare/v4.0.0...v4.1.0) diff --git a/README.md b/README.md index 44548f084d5..603a1859f26 100644 --- a/README.md +++ b/README.md @@ -151,17 +151,16 @@ from cloudflare import Cloudflare client = Cloudflare() -account = client.accounts.create( - name="name", - type="standard", - unit={"id": "f267e341f3dd4697bd3b9f71dd96247f"}, +zone = client.zones.create( + account={"id": "023e105f4ecef8ad9ca31a8372d0c353"}, + name="example.com", ) -print(account.unit) +print(zone.account) ``` ## File uploads -Request parameters that correspond to file uploads can be passed as `bytes`, a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`. +Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`. ```python from pathlib import Path diff --git a/api.md b/api.md index 50bdbfeb44b..d4b626871d6 100644 --- a/api.md +++ b/api.md @@ -151,7 +151,7 @@ from cloudflare.types.origin_ca_certificates import ( Methods: - client.origin_ca_certificates.create(\*\*params) -> Optional[OriginCACertificate] -- client.origin_ca_certificates.list(\*\*params) -> SyncSinglePage[OriginCACertificate] +- client.origin_ca_certificates.list(\*\*params) -> SyncV4PagePaginationArray[OriginCACertificate] - client.origin_ca_certificates.delete(certificate_id) -> Optional[OriginCACertificateDeleteResponse] - client.origin_ca_certificates.get(certificate_id) -> Optional[OriginCACertificate] @@ -985,18 +985,13 @@ Methods: Types: ```python -from cloudflare.types.custom_nameservers import ( - CustomNameserver, - CustomNameserverDeleteResponse, - CustomNameserverAvailabiltyResponse, -) +from cloudflare.types.custom_nameservers import CustomNameserver, CustomNameserverDeleteResponse ``` Methods: - client.custom_nameservers.create(\*, account_id, \*\*params) -> Optional[CustomNameserver] - client.custom_nameservers.delete(custom_ns_id, \*, account_id) -> SyncSinglePage[CustomNameserverDeleteResponse] -- client.custom_nameservers.availabilty(\*, account_id) -> SyncSinglePage[CustomNameserverAvailabiltyResponse] - client.custom_nameservers.get(\*, account_id) -> SyncSinglePage[CustomNameserver] # DNSFirewall @@ -2115,7 +2110,7 @@ Methods: Types: ```python -from cloudflare.types.rate_limits import Action, Methods, RateLimit, RateLimitDeleteResponse +from cloudflare.types.rate_limits import Action, RateLimit, RateLimitDeleteResponse ``` Methods: @@ -2317,10 +2312,10 @@ from cloudflare.types.workers import ( Methods: - client.workers.routes.create(\*, zone_id, \*\*params) -> RouteCreateResponse -- client.workers.routes.update(route_id, \*, zone_id, \*\*params) -> Optional[RouteUpdateResponse] +- client.workers.routes.update(route_id, \*, zone_id, \*\*params) -> RouteUpdateResponse - client.workers.routes.list(\*, zone_id) -> SyncSinglePage[RouteListResponse] - client.workers.routes.delete(route_id, \*, zone_id) -> RouteDeleteResponse -- client.workers.routes.get(route_id, \*, zone_id) -> Optional[RouteGetResponse] +- client.workers.routes.get(route_id, \*, zone_id) -> RouteGetResponse ## Assets @@ -2341,14 +2336,20 @@ Methods: Types: ```python -from cloudflare.types.workers import Script, ScriptSetting, ScriptUpdateResponse, ScriptGetResponse +from cloudflare.types.workers import ( + Script, + ScriptSetting, + ScriptUpdateResponse, + ScriptDeleteResponse, + ScriptGetResponse, +) ``` Methods: -- client.workers.scripts.update(script_name, \*, account_id, \*\*params) -> Optional[ScriptUpdateResponse] +- client.workers.scripts.update(script_name, \*, account_id, \*\*params) -> ScriptUpdateResponse - client.workers.scripts.list(\*, account_id) -> SyncSinglePage[Script] -- client.workers.scripts.delete(script_name, \*, account_id, \*\*params) -> None +- client.workers.scripts.delete(script_name, \*, account_id, \*\*params) -> object - client.workers.scripts.get(script_name, \*, account_id) -> str ### Assets @@ -2370,12 +2371,17 @@ Methods: Types: ```python -from cloudflare.types.workers.scripts import SubdomainCreateResponse, SubdomainGetResponse +from cloudflare.types.workers.scripts import ( + SubdomainCreateResponse, + SubdomainDeleteResponse, + SubdomainGetResponse, +) ``` Methods: - client.workers.scripts.subdomain.create(script_name, \*, account_id, \*\*params) -> SubdomainCreateResponse +- client.workers.scripts.subdomain.delete(script_name, \*, account_id) -> SubdomainDeleteResponse - client.workers.scripts.subdomain.get(script_name, \*, account_id) -> SubdomainGetResponse ### Schedules @@ -2383,13 +2389,13 @@ Methods: Types: ```python -from cloudflare.types.workers.scripts import Schedule, ScheduleUpdateResponse, ScheduleGetResponse +from cloudflare.types.workers.scripts import ScheduleUpdateResponse, ScheduleGetResponse ``` Methods: -- client.workers.scripts.schedules.update(script_name, \*, account_id, \*\*params) -> Optional[ScheduleUpdateResponse] -- client.workers.scripts.schedules.get(script_name, \*, account_id) -> Optional[ScheduleGetResponse] +- client.workers.scripts.schedules.update(script_name, \*, account_id, \*\*params) -> ScheduleUpdateResponse +- client.workers.scripts.schedules.get(script_name, \*, account_id) -> ScheduleGetResponse ### Tail @@ -2406,23 +2412,23 @@ from cloudflare.types.workers.scripts import ( Methods: -- client.workers.scripts.tail.create(script_name, \*, account_id, \*\*params) -> Optional[TailCreateResponse] +- client.workers.scripts.tail.create(script_name, \*, account_id, \*\*params) -> TailCreateResponse - client.workers.scripts.tail.delete(id, \*, account_id, script_name) -> TailDeleteResponse -- client.workers.scripts.tail.get(script_name, \*, account_id) -> Optional[TailGetResponse] +- client.workers.scripts.tail.get(script_name, \*, account_id) -> TailGetResponse ### Content Methods: -- client.workers.scripts.content.update(script_name, \*, account_id, \*\*params) -> Optional[Script] +- client.workers.scripts.content.update(script_name, \*, account_id, \*\*params) -> Script - client.workers.scripts.content.get(script_name, \*, account_id) -> BinaryAPIResponse ### Settings Methods: -- client.workers.scripts.settings.edit(script_name, \*, account_id, \*\*params) -> Optional[ScriptSetting] -- client.workers.scripts.settings.get(script_name, \*, account_id) -> Optional[ScriptSetting] +- client.workers.scripts.settings.edit(script_name, \*, account_id, \*\*params) -> ScriptSetting +- client.workers.scripts.settings.get(script_name, \*, account_id) -> ScriptSetting ### Deployments @@ -2455,9 +2461,9 @@ from cloudflare.types.workers.scripts import ( Methods: -- client.workers.scripts.versions.create(script_name, \*, account_id, \*\*params) -> Optional[VersionCreateResponse] +- client.workers.scripts.versions.create(script_name, \*, account_id, \*\*params) -> VersionCreateResponse - client.workers.scripts.versions.list(script_name, \*, account_id, \*\*params) -> SyncV4PagePagination[VersionListResponse] -- client.workers.scripts.versions.get(version_id, \*, account_id, script_name) -> Optional[VersionGetResponse] +- client.workers.scripts.versions.get(version_id, \*, account_id, script_name) -> VersionGetResponse ### Secrets @@ -2479,6 +2485,22 @@ Methods: - client.workers.scripts.secrets.delete(secret_name, \*, account_id, script_name) -> object - client.workers.scripts.secrets.get(secret_name, \*, account_id, script_name) -> Optional[SecretGetResponse] +### ScriptAndVersionSettings + +Types: + +```python +from cloudflare.types.workers.scripts import ( + ScriptAndVersionSettingEditResponse, + ScriptAndVersionSettingGetResponse, +) +``` + +Methods: + +- client.workers.scripts.script_and_version_settings.edit(script_name, \*, account_id, \*\*params) -> ScriptAndVersionSettingEditResponse +- client.workers.scripts.script_and_version_settings.get(script_name, \*, account_id) -> ScriptAndVersionSettingGetResponse + ## AccountSettings Types: @@ -2489,8 +2511,8 @@ from cloudflare.types.workers import AccountSettingUpdateResponse, AccountSettin Methods: -- client.workers.account_settings.update(\*, account_id, \*\*params) -> Optional[AccountSettingUpdateResponse] -- client.workers.account_settings.get(\*, account_id) -> Optional[AccountSettingGetResponse] +- client.workers.account_settings.update(\*, account_id, \*\*params) -> AccountSettingUpdateResponse +- client.workers.account_settings.get(\*, account_id) -> AccountSettingGetResponse ## Domains @@ -2517,59 +2539,66 @@ from cloudflare.types.workers import SubdomainUpdateResponse, SubdomainGetRespon Methods: -- client.workers.subdomains.update(\*, account_id, \*\*params) -> Optional[SubdomainUpdateResponse] -- client.workers.subdomains.get(\*, account_id) -> Optional[SubdomainGetResponse] +- client.workers.subdomains.update(\*, account_id, \*\*params) -> SubdomainUpdateResponse +- client.workers.subdomains.get(\*, account_id) -> SubdomainGetResponse -# KV +## Observability -## Namespaces +### Telemetry Types: ```python -from cloudflare.types.kv import ( - Namespace, - NamespaceUpdateResponse, - NamespaceDeleteResponse, - NamespaceBulkDeleteResponse, - NamespaceBulkUpdateResponse, +from cloudflare.types.workers.observability import ( + TelemetryKeysResponse, + TelemetryQueryResponse, + TelemetryValuesResponse, ) ``` Methods: -- client.kv.namespaces.create(\*, account_id, \*\*params) -> Optional[Namespace] -- client.kv.namespaces.update(namespace_id, \*, account_id, \*\*params) -> Optional[NamespaceUpdateResponse] -- client.kv.namespaces.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[Namespace] -- client.kv.namespaces.delete(namespace_id, \*, account_id) -> Optional[NamespaceDeleteResponse] -- client.kv.namespaces.bulk_delete(namespace_id, \*, account_id, \*\*params) -> Optional[NamespaceBulkDeleteResponse] -- client.kv.namespaces.bulk_update(namespace_id, \*, account_id, \*\*params) -> Optional[NamespaceBulkUpdateResponse] -- client.kv.namespaces.get(namespace_id, \*, account_id) -> Optional[Namespace] +- client.workers.observability.telemetry.keys(\*, account_id, \*\*params) -> SyncSinglePage[TelemetryKeysResponse] +- client.workers.observability.telemetry.query(\*, account_id, \*\*params) -> TelemetryQueryResponse +- client.workers.observability.telemetry.values(\*, account_id, \*\*params) -> SyncSinglePage[TelemetryValuesResponse] -### Analytics +# KV + +## Namespaces Types: ```python -from cloudflare.types.kv.namespaces import Components, Schema +from cloudflare.types.kv import Namespace, NamespaceDeleteResponse ``` Methods: -- client.kv.namespaces.analytics.list(\*, account_id, \*\*params) -> Optional[Schema] -- client.kv.namespaces.analytics.stored(\*, account_id, \*\*params) -> Optional[Components] +- client.kv.namespaces.create(\*, account_id, \*\*params) -> Optional[Namespace] +- client.kv.namespaces.update(namespace_id, \*, account_id, \*\*params) -> Namespace +- client.kv.namespaces.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[Namespace] +- client.kv.namespaces.delete(namespace_id, \*, account_id) -> Optional[NamespaceDeleteResponse] +- client.kv.namespaces.get(namespace_id, \*, account_id) -> Optional[Namespace] ### Keys Types: ```python -from cloudflare.types.kv.namespaces import Key +from cloudflare.types.kv.namespaces import ( + Key, + KeyBulkDeleteResponse, + KeyBulkGetResponse, + KeyBulkUpdateResponse, +) ``` Methods: - client.kv.namespaces.keys.list(namespace_id, \*, account_id, \*\*params) -> SyncCursorLimitPagination[Key] +- client.kv.namespaces.keys.bulk_delete(namespace_id, \*, account_id, \*\*params) -> Optional[KeyBulkDeleteResponse] +- client.kv.namespaces.keys.bulk_get(namespace_id, \*, account_id, \*\*params) -> Optional[KeyBulkGetResponse] +- client.kv.namespaces.keys.bulk_update(namespace_id, \*, account_id, \*\*params) -> Optional[KeyBulkUpdateResponse] ### Metadata @@ -2637,6 +2666,7 @@ Methods: - client.queues.update(queue_id, \*, account_id, \*\*params) -> Optional[Queue] - client.queues.list(\*, account_id) -> SyncSinglePage[Queue] - client.queues.delete(queue_id, \*, account_id) -> QueueDeleteResponse +- client.queues.edit(queue_id, \*, account_id, \*\*params) -> Optional[Queue] - client.queues.get(queue_id, \*, account_id) -> Optional[Queue] ## Consumers @@ -2659,13 +2689,33 @@ Methods: Types: ```python -from cloudflare.types.queues import MessageAckResponse, MessagePullResponse +from cloudflare.types.queues import ( + MessageAckResponse, + MessageBulkPushResponse, + MessagePullResponse, + MessagePushResponse, +) ``` Methods: - client.queues.messages.ack(queue_id, \*, account_id, \*\*params) -> Optional[MessageAckResponse] +- client.queues.messages.bulk_push(queue_id, \*, account_id, \*\*params) -> MessageBulkPushResponse - client.queues.messages.pull(queue_id, \*, account_id, \*\*params) -> SyncSinglePage[MessagePullResponse] +- client.queues.messages.push(queue_id, \*, account_id, \*\*params) -> MessagePushResponse + +## Purge + +Types: + +```python +from cloudflare.types.queues import PurgeStatusResponse +``` + +Methods: + +- client.queues.purge.start(queue_id, \*, account_id, \*\*params) -> Optional[Queue] +- client.queues.purge.status(queue_id, \*, account_id) -> Optional[PurgeStatusResponse] # APIGateway @@ -3720,6 +3770,7 @@ from cloudflare.types.magic_transit import ( AppUpdateResponse, AppListResponse, AppDeleteResponse, + AppEditResponse, ) ``` @@ -3729,6 +3780,7 @@ Methods: - client.magic_transit.apps.update(account_app_id, \*, account_id, \*\*params) -> Optional[AppUpdateResponse] - client.magic_transit.apps.list(\*, account_id) -> SyncSinglePage[AppListResponse] - client.magic_transit.apps.delete(account_app_id, \*, account_id) -> Optional[AppDeleteResponse] +- client.magic_transit.apps.edit(account_app_id, \*, account_id, \*\*params) -> Optional[AppEditResponse] ## CfInterconnects @@ -3933,8 +3985,20 @@ from cloudflare.types.magic_transit.connectors import EventListResponse, EventGe Methods: -- client.magic_transit.connectors.events.list(connector_id, \*, account_id, \*\*params) -> EventListResponse -- client.magic_transit.connectors.events.get(event_n, \*, account_id, connector_id, event_t) -> EventGetResponse +- client.magic_transit.connectors.events.list(connector_id, \*, account_id, \*\*params) -> EventListResponse +- client.magic_transit.connectors.events.get(event_n, \*, account_id, connector_id, event_t) -> EventGetResponse + +#### Latest + +Types: + +```python +from cloudflare.types.magic_transit.connectors.events import LatestListResponse +``` + +Methods: + +- client.magic_transit.connectors.events.latest.list(connector_id, \*, account_id) -> LatestListResponse ### Snapshots @@ -3946,8 +4010,20 @@ from cloudflare.types.magic_transit.connectors import SnapshotListResponse, Snap Methods: -- client.magic_transit.connectors.snapshots.list(connector_id, \*, account_id, \*\*params) -> SnapshotListResponse -- client.magic_transit.connectors.snapshots.get(snapshot_t, \*, account_id, connector_id) -> SnapshotGetResponse +- client.magic_transit.connectors.snapshots.list(connector_id, \*, account_id, \*\*params) -> SnapshotListResponse +- client.magic_transit.connectors.snapshots.get(snapshot_t, \*, account_id, connector_id) -> SnapshotGetResponse + +#### Latest + +Types: + +```python +from cloudflare.types.magic_transit.connectors.snapshots import LatestListResponse +``` + +Methods: + +- client.magic_transit.connectors.snapshots.latest.list(connector_id, \*, account_id) -> LatestListResponse ## PCAPs @@ -3968,6 +4044,7 @@ Methods: - client.magic_transit.pcaps.create(\*, account_id, \*\*params) -> PCAPCreateResponse - client.magic_transit.pcaps.list(\*, account_id) -> SyncSinglePage[PCAPListResponse] - client.magic_transit.pcaps.get(pcap_id, \*, account_id) -> PCAPGetResponse +- client.magic_transit.pcaps.stop(pcap_id, \*, account_id) -> None ### Ownership @@ -4406,28 +4483,37 @@ Methods: Types: ```python -from cloudflare.types.rules import Hostname, ListsList, Redirect, ListDeleteResponse +from cloudflare.types.rules import ( + Hostname, + ListsList, + Redirect, + ListCreateResponse, + ListUpdateResponse, + ListListResponse, + ListDeleteResponse, + ListGetResponse, +) ``` Methods: -- client.rules.lists.create(\*, account_id, \*\*params) -> ListsList -- client.rules.lists.update(list_id, \*, account_id, \*\*params) -> ListsList -- client.rules.lists.list(\*, account_id) -> SyncSinglePage[ListsList] +- client.rules.lists.create(\*, account_id, \*\*params) -> ListCreateResponse +- client.rules.lists.update(list_id, \*, account_id, \*\*params) -> ListUpdateResponse +- client.rules.lists.list(\*, account_id) -> ListListResponse - client.rules.lists.delete(list_id, \*, account_id) -> ListDeleteResponse -- client.rules.lists.get(list_id, \*, account_id) -> ListsList +- client.rules.lists.get(list_id, \*, account_id) -> ListGetResponse ### BulkOperations Types: ```python -from cloudflare.types.rules.lists import OperationStatus, BulkOperationGetResponse +from cloudflare.types.rules.lists import BulkOperationGetResponse ``` Methods: -- client.rules.lists.bulk_operations.get(operation_id, \*, account_identifier) -> BulkOperationGetResponse +- client.rules.lists.bulk_operations.get(operation_id, \*, account_id) -> BulkOperationGetResponse ### Items @@ -4449,9 +4535,9 @@ Methods: - client.rules.lists.items.create(list_id, \*, account_id, \*\*params) -> ItemCreateResponse - client.rules.lists.items.update(list_id, \*, account_id, \*\*params) -> ItemUpdateResponse -- client.rules.lists.items.list(list_id, \*, account_id, \*\*params) -> SyncCursorPagination[ItemListResponse] +- client.rules.lists.items.list(list_id, \*, account_id, \*\*params) -> ItemListResponse - client.rules.lists.items.delete(list_id, \*, account_id) -> ItemDeleteResponse -- client.rules.lists.items.get(item_id, \*, account_identifier, list_id) -> ItemGetResponse +- client.rules.lists.items.get(item_id, \*, account_id, list_id) -> ItemGetResponse # Stream @@ -4811,8 +4897,10 @@ from cloudflare.types.d1 import ( Methods: - client.d1.database.create(\*, account_id, \*\*params) -> D1 +- client.d1.database.update(database_id, \*, account_id, \*\*params) -> D1 - client.d1.database.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[DatabaseListResponse] - client.d1.database.delete(database_id, \*, account_id) -> object +- client.d1.database.edit(database_id, \*, account_id, \*\*params) -> D1 - client.d1.database.export(database_id, \*, account_id, \*\*params) -> DatabaseExportResponse - client.d1.database.get(database_id, \*, account_id) -> D1 - client.d1.database.import\_(database_id, \*, account_id, \*\*params) -> DatabaseImportResponse @@ -4834,6 +4922,7 @@ Methods: - client.r2.buckets.create(\*, account_id, \*\*params) -> Bucket - client.r2.buckets.list(\*, account_id, \*\*params) -> BucketListResponse - client.r2.buckets.delete(bucket_name, \*, account_id) -> object +- client.r2.buckets.edit(bucket_name, \*, account_id) -> Bucket - client.r2.buckets.get(bucket_name, \*, account_id) -> Bucket ### Lifecycle @@ -4907,6 +4996,7 @@ Types: ```python from cloudflare.types.r2.buckets import ( EventNotificationUpdateResponse, + EventNotificationListResponse, EventNotificationDeleteResponse, EventNotificationGetResponse, ) @@ -4915,8 +5005,9 @@ from cloudflare.types.r2.buckets import ( Methods: - client.r2.buckets.event_notifications.update(queue_id, \*, account_id, bucket_name, \*\*params) -> object +- client.r2.buckets.event_notifications.list(bucket_name, \*, account_id) -> EventNotificationListResponse - client.r2.buckets.event_notifications.delete(queue_id, \*, account_id, bucket_name) -> object -- client.r2.buckets.event_notifications.get(bucket_name, \*, account_id) -> EventNotificationGetResponse +- client.r2.buckets.event_notifications.get(queue_id, \*, account_id, bucket_name) -> EventNotificationGetResponse ### Locks @@ -4969,6 +5060,64 @@ Methods: - client.r2.temporary_credentials.create(\*, account_id, \*\*params) -> TemporaryCredentialCreateResponse +## SuperSlurper + +### Jobs + +Types: + +```python +from cloudflare.types.r2.super_slurper import ( + JobCreateResponse, + JobListResponse, + JobAbortResponse, + JobAbortAllResponse, + JobGetResponse, + JobPauseResponse, + JobProgressResponse, + JobResumeResponse, +) +``` + +Methods: + +- client.r2.super_slurper.jobs.create(\*, account_id, \*\*params) -> Optional[JobCreateResponse] +- client.r2.super_slurper.jobs.list(\*, account_id, \*\*params) -> SyncSinglePage[JobListResponse] +- client.r2.super_slurper.jobs.abort(job_id, \*, account_id) -> str +- client.r2.super_slurper.jobs.abort_all(\*, account_id) -> str +- client.r2.super_slurper.jobs.get(job_id, \*, account_id) -> Optional[JobGetResponse] +- client.r2.super_slurper.jobs.pause(job_id, \*, account_id) -> str +- client.r2.super_slurper.jobs.progress(job_id, \*, account_id) -> Optional[JobProgressResponse] +- client.r2.super_slurper.jobs.resume(job_id, \*, account_id) -> str + +#### Logs + +Types: + +```python +from cloudflare.types.r2.super_slurper.jobs import LogListResponse +``` + +Methods: + +- client.r2.super_slurper.jobs.logs.list(job_id, \*, account_id, \*\*params) -> SyncSinglePage[LogListResponse] + +### ConnectivityPrecheck + +Types: + +```python +from cloudflare.types.r2.super_slurper import ( + ConnectivityPrecheckSourceResponse, + ConnectivityPrecheckTargetResponse, +) +``` + +Methods: + +- client.r2.super_slurper.connectivity_precheck.source(\*, account_id, \*\*params) -> Optional[ConnectivityPrecheckSourceResponse] +- client.r2.super_slurper.connectivity_precheck.target(\*, account_id, \*\*params) -> Optional[ConnectivityPrecheckTargetResponse] + # WorkersForPlatforms ## Dispatch @@ -4998,14 +5147,18 @@ Methods: Types: ```python -from cloudflare.types.workers_for_platforms.dispatch.namespaces import Script, ScriptUpdateResponse +from cloudflare.types.workers_for_platforms.dispatch.namespaces import ( + Script, + ScriptUpdateResponse, + ScriptDeleteResponse, +) ``` Methods: -- client.workers_for_platforms.dispatch.namespaces.scripts.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional[ScriptUpdateResponse] -- client.workers_for_platforms.dispatch.namespaces.scripts.delete(script_name, \*, account_id, dispatch_namespace, \*\*params) -> None -- client.workers_for_platforms.dispatch.namespaces.scripts.get(script_name, \*, account_id, dispatch_namespace) -> Optional[Script] +- client.workers_for_platforms.dispatch.namespaces.scripts.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> ScriptUpdateResponse +- client.workers_for_platforms.dispatch.namespaces.scripts.delete(script_name, \*, account_id, dispatch_namespace, \*\*params) -> object +- client.workers_for_platforms.dispatch.namespaces.scripts.get(script_name, \*, account_id, dispatch_namespace) -> Script ##### AssetUpload @@ -5025,7 +5178,7 @@ Methods: Methods: -- client.workers_for_platforms.dispatch.namespaces.scripts.content.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional[Script] +- client.workers_for_platforms.dispatch.namespaces.scripts.content.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Script - client.workers_for_platforms.dispatch.namespaces.scripts.content.get(script_name, \*, account_id, dispatch_namespace) -> BinaryAPIResponse ##### Settings @@ -5071,10 +5224,10 @@ from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import ( Methods: -- client.workers_for_platforms.dispatch.namespaces.scripts.secrets.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional[SecretUpdateResponse] +- client.workers_for_platforms.dispatch.namespaces.scripts.secrets.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> SecretUpdateResponse - client.workers_for_platforms.dispatch.namespaces.scripts.secrets.list(script_name, \*, account_id, dispatch_namespace) -> SyncSinglePage[SecretListResponse] - client.workers_for_platforms.dispatch.namespaces.scripts.secrets.delete(secret_name, \*, account_id, dispatch_namespace, script_name) -> object -- client.workers_for_platforms.dispatch.namespaces.scripts.secrets.get(secret_name, \*, account_id, dispatch_namespace, script_name) -> Optional[SecretGetResponse] +- client.workers_for_platforms.dispatch.namespaces.scripts.secrets.get(secret_name, \*, account_id, dispatch_namespace, script_name) -> SecretGetResponse ##### Tags @@ -5109,26 +5262,91 @@ Methods: - client.zero_trust.devices.list(\*, account_id) -> SyncSinglePage[Device] - client.zero_trust.devices.get(device_id, \*, account_id) -> Optional[DeviceGetResponse] +### Devices + +Types: + +```python +from cloudflare.types.zero_trust.devices import ( + DeviceListResponse, + DeviceDeleteResponse, + DeviceGetResponse, + DeviceRevokeResponse, +) +``` + +Methods: + +- client.zero*trust.devices.devices.list(\*, account_id, \*\*params) -> SyncCursorPagination[DeviceListResponse] +- client.zero*trust.devices.devices.delete(device_id, \*, account_id) -> object +- client.zero*trust.devices.devices.get(device_id, \*, account_id) -> DeviceGetResponse +- client.zero*trust.devices.devices.revoke(device_id, \*, account_id) -> object + +### Resilience + +#### GlobalWARPOverride + +Types: + +```python +from cloudflare.types.zero_trust.devices.resilience import ( + GlobalWARPOverrideCreateResponse, + GlobalWARPOverrideGetResponse, +) +``` + +Methods: + +- client.zero_trust.devices.resilience.global_warp_override.create(\*, account_id, \*\*params) -> Optional[GlobalWARPOverrideCreateResponse] +- client.zero_trust.devices.resilience.global_warp_override.get(\*, account_id) -> Optional[GlobalWARPOverrideGetResponse] + +### Registrations + +Types: + +```python +from cloudflare.types.zero_trust.devices import ( + RegistrationListResponse, + RegistrationDeleteResponse, + RegistrationBulkDeleteResponse, + RegistrationGetResponse, + RegistrationRevokeResponse, + RegistrationUnrevokeResponse, +) +``` + +Methods: + +- client.zero_trust.devices.registrations.list(\*, account_id, \*\*params) -> SyncCursorPagination[RegistrationListResponse] +- client.zero_trust.devices.registrations.delete(registration_id, \*, account_id) -> object +- client.zero_trust.devices.registrations.bulk_delete(\*, account_id, \*\*params) -> object +- client.zero_trust.devices.registrations.get(registration_id, \*, account_id) -> RegistrationGetResponse +- client.zero_trust.devices.registrations.revoke(\*, account_id, \*\*params) -> object +- client.zero_trust.devices.registrations.unrevoke(\*, account_id, \*\*params) -> object + ### DEXTests Types: ```python from cloudflare.types.zero_trust.devices import ( - DEXTest, SchemaData, SchemaHTTP, + DEXTestCreateResponse, + DEXTestUpdateResponse, + DEXTestListResponse, DEXTestDeleteResponse, + DEXTestGetResponse, ) ``` Methods: -- client.zero_trust.devices.dex_tests.create(\*, account_id, \*\*params) -> Optional[SchemaHTTP] -- client.zero_trust.devices.dex_tests.update(dex_test_id, \*, account_id, \*\*params) -> Optional[SchemaHTTP] -- client.zero_trust.devices.dex_tests.list(\*, account_id) -> SyncSinglePage[SchemaHTTP] -- client.zero_trust.devices.dex_tests.delete(dex_test_id, \*, account_id) -> DEXTestDeleteResponse -- client.zero_trust.devices.dex_tests.get(dex_test_id, \*, account_id) -> Optional[SchemaHTTP] +- client.zero_trust.devices.dex_tests.create(\*, account_id, \*\*params) -> Optional[DEXTestCreateResponse] +- client.zero_trust.devices.dex_tests.update(dex_test_id, \*, account_id, \*\*params) -> Optional[DEXTestUpdateResponse] +- client.zero_trust.devices.dex_tests.list(\*, account_id) -> SyncSinglePage[DEXTestListResponse] +- client.zero_trust.devices.dex_tests.delete(dex_test_id, \*, account_id) -> Optional[DEXTestDeleteResponse] +- client.zero_trust.devices.dex_tests.get(dex_test_id, \*, account_id) -> Optional[DEXTestGetResponse] ### Networks @@ -5209,19 +5427,10 @@ Methods: ##### Certificates -Types: - -```python -from cloudflare.types.zero_trust.devices.policies.default import ( - CertificateEditResponse, - CertificateGetResponse, -) -``` - Methods: -- client.zero_trust.devices.policies.default.certificates.edit(\*, zone_id, \*\*params) -> Optional[CertificateEditResponse] -- client.zero_trust.devices.policies.default.certificates.get(\*, zone_id) -> Optional[CertificateGetResponse] +- client.zero_trust.devices.policies.default.certificates.edit(\*, zone_id, \*\*params) -> Optional[DevicePolicyCertificates] +- client.zero_trust.devices.policies.default.certificates.get(\*, zone_id) -> Optional[DevicePolicyCertificates] #### Custom @@ -5329,8 +5538,8 @@ from cloudflare.types.zero_trust.devices import DeviceSettings Methods: - client.zero_trust.devices.settings.update(\*, account_id, \*\*params) -> Optional[DeviceSettings] -- client.zero_trust.devices.settings.list(\*, account_id) -> Optional[DeviceSettings] - client.zero_trust.devices.settings.edit(\*, account_id, \*\*params) -> Optional[DeviceSettings] +- client.zero_trust.devices.settings.get(\*, account_id) -> Optional[DeviceSettings] ### Unrevoke @@ -5349,12 +5558,13 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.devices import OverrideCodeListResponse +from cloudflare.types.zero_trust.devices import OverrideCodeListResponse, OverrideCodeGetResponse ``` Methods: -- client.zero_trust.devices.override_codes.list(device_id, \*, account_id) -> Optional[OverrideCodeListResponse] +- client.zero_trust.devices.override_codes.list(device_id, \*, account_id) -> SyncSinglePage[object] +- client.zero_trust.devices.override_codes.get(registration_id, \*, account_id) -> OverrideCodeGetResponse ## IdentityProviders @@ -5477,7 +5687,7 @@ Methods: - client.zero_trust.access.infrastructure.targets.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[TargetListResponse] - client.zero_trust.access.infrastructure.targets.delete(target_id, \*, account_id) -> None - client.zero_trust.access.infrastructure.targets.bulk_delete(\*, account_id) -> None -- client.zero_trust.access.infrastructure.targets.bulk_update(\*, account_id, \*\*params) -> TargetBulkUpdateResponse +- client.zero_trust.access.infrastructure.targets.bulk_update(\*, account_id, \*\*params) -> SyncSinglePage[TargetBulkUpdateResponse] - client.zero_trust.access.infrastructure.targets.get(target_id, \*, account_id) -> Optional[TargetGetResponse] ### Applications @@ -5609,7 +5819,7 @@ from cloudflare.types.zero_trust.access.applications import ( Methods: - client.zero_trust.access.applications.policy_tests.create(\*, account_id, \*\*params) -> Optional[PolicyTestCreateResponse] -- client.zero_trust.access.applications.policy_tests.get(policy_test_id, \*, account_id, \*\*params) -> Optional[PolicyTestGetResponse] +- client.zero_trust.access.applications.policy_tests.get(policy_test_id, \*, account_id) -> Optional[PolicyTestGetResponse] ##### Users @@ -5621,7 +5831,23 @@ from cloudflare.types.zero_trust.access.applications.policy_tests import UserLis Methods: -- client.zero_trust.access.applications.policy_tests.users.list(policy_test_id, \*, account_id, \*\*params) -> SyncSinglePage[UserListResponse] +- client.zero_trust.access.applications.policy_tests.users.list(policy_test_id, \*, account_id, \*\*params) -> SyncV4PagePaginationArray[UserListResponse] + +#### Settings + +Types: + +```python +from cloudflare.types.zero_trust.access.applications import ( + SettingUpdateResponse, + SettingEditResponse, +) +``` + +Methods: + +- client.zero_trust.access.applications.settings.update(app_id, \*, account_id, zone_id, \*\*params) -> Optional[SettingUpdateResponse] +- client.zero_trust.access.applications.settings.edit(app_id, \*, account_id, zone_id, \*\*params) -> Optional[SettingEditResponse] ### Certificates @@ -6939,7 +7165,7 @@ from cloudflare.types.url_scanner import ( Methods: -- client.url_scanner.scans.create(\*, account_id, \*\*params) -> str +- client.url_scanner.scans.create(\*, account_id, \*\*params) -> ScanCreateResponse - client.url_scanner.scans.list(\*, account_id, \*\*params) -> ScanListResponse - client.url_scanner.scans.bulk_create(\*, account_id, \*\*params) -> ScanBulkCreateResponse - client.url_scanner.scans.dom(scan_id, \*, account_id) -> str @@ -6951,6 +7177,18 @@ Methods: ## AI +### ToMarkdown + +Types: + +```python +from cloudflare.types.radar.ai import ToMarkdownCreateResponse +``` + +Methods: + +- client.radar.ai.to_markdown.create(\*, account_id, \*\*params) -> SyncSinglePage[ToMarkdownCreateResponse] + ### Inference #### Summary @@ -7109,6 +7347,7 @@ from cloudflare.types.radar.bgp import ( RouteAsesResponse, RouteMoasResponse, RoutePfx2asResponse, + RouteRealtimeResponse, RouteStatsResponse, ) ``` @@ -7118,6 +7357,7 @@ Methods: - client.radar.bgp.routes.ases(\*\*params) -> RouteAsesResponse - client.radar.bgp.routes.moas(\*\*params) -> RouteMoasResponse - client.radar.bgp.routes.pfx2as(\*\*params) -> RoutePfx2asResponse +- client.radar.bgp.routes.realtime(\*\*params) -> RouteRealtimeResponse - client.radar.bgp.routes.stats(\*\*params) -> RouteStatsResponse ### IPs @@ -7560,9 +7800,11 @@ Types: from cloudflare.types.radar.attacks.layer3 import ( SummaryBitrateResponse, SummaryDurationResponse, + SummaryIndustryResponse, SummaryIPVersionResponse, SummaryProtocolResponse, SummaryVectorResponse, + SummaryVerticalResponse, ) ``` @@ -7570,9 +7812,11 @@ Methods: - client.radar.attacks.layer3.summary.bitrate(\*\*params) -> SummaryBitrateResponse - client.radar.attacks.layer3.summary.duration(\*\*params) -> SummaryDurationResponse +- client.radar.attacks.layer3.summary.industry(\*\*params) -> SummaryIndustryResponse - client.radar.attacks.layer3.summary.ip_version(\*\*params) -> SummaryIPVersionResponse - client.radar.attacks.layer3.summary.protocol(\*\*params) -> SummaryProtocolResponse - client.radar.attacks.layer3.summary.vector(\*\*params) -> SummaryVectorResponse +- client.radar.attacks.layer3.summary.vertical(\*\*params) -> SummaryVerticalResponse #### TimeseriesGroups @@ -7651,9 +7895,11 @@ Types: from cloudflare.types.radar.attacks.layer7 import ( SummaryHTTPMethodResponse, SummaryHTTPVersionResponse, + SummaryIndustryResponse, SummaryIPVersionResponse, SummaryManagedRulesResponse, SummaryMitigationProductResponse, + SummaryVerticalResponse, ) ``` @@ -7661,9 +7907,11 @@ Methods: - client.radar.attacks.layer7.summary.http_method(\*\*params) -> SummaryHTTPMethodResponse - client.radar.attacks.layer7.summary.http_version(\*\*params) -> SummaryHTTPVersionResponse +- client.radar.attacks.layer7.summary.industry(\*\*params) -> SummaryIndustryResponse - client.radar.attacks.layer7.summary.ip_version(\*\*params) -> SummaryIPVersionResponse - client.radar.attacks.layer7.summary.managed_rules(\*\*params) -> SummaryManagedRulesResponse - client.radar.attacks.layer7.summary.mitigation_product(\*\*params) -> SummaryMitigationProductResponse +- client.radar.attacks.layer7.summary.vertical(\*\*params) -> SummaryVerticalResponse #### TimeseriesGroups @@ -8618,14 +8866,14 @@ from cloudflare.types.cloudforce_one import ( Methods: -- client.cloudforce_one.requests.create(account_identifier, \*\*params) -> Optional[Item] -- client.cloudforce_one.requests.update(request_identifier, \*, account_identifier, \*\*params) -> Optional[Item] -- client.cloudforce_one.requests.list(account_identifier, \*\*params) -> SyncSinglePage[ListItem] -- client.cloudforce_one.requests.delete(request_identifier, \*, account_identifier) -> RequestDeleteResponse -- client.cloudforce_one.requests.constants(account_identifier) -> Optional[RequestConstants] -- client.cloudforce_one.requests.get(request_identifier, \*, account_identifier) -> Optional[Item] -- client.cloudforce_one.requests.quota(account_identifier) -> Optional[Quota] -- client.cloudforce_one.requests.types(account_identifier) -> SyncSinglePage[RequestTypesResponse] +- client.cloudforce_one.requests.create(\*, account_id, \*\*params) -> Optional[Item] +- client.cloudforce_one.requests.update(request_id, \*, account_id, \*\*params) -> Optional[Item] +- client.cloudforce_one.requests.list(\*, account_id, \*\*params) -> SyncSinglePage[ListItem] +- client.cloudforce_one.requests.delete(request_id, \*, account_id) -> RequestDeleteResponse +- client.cloudforce_one.requests.constants(\*, account_id) -> Optional[RequestConstants] +- client.cloudforce_one.requests.get(request_id, \*, account_id) -> Optional[Item] +- client.cloudforce_one.requests.quota(\*, account_id) -> Optional[Quota] +- client.cloudforce_one.requests.types(\*, account_id) -> SyncSinglePage[RequestTypesResponse] ### Message @@ -8637,10 +8885,10 @@ from cloudflare.types.cloudforce_one.requests import Message, MessageDeleteRespo Methods: -- client.cloudforce_one.requests.message.create(request_identifier, \*, account_identifier, \*\*params) -> Optional[Message] -- client.cloudforce_one.requests.message.update(message_identifer, \*, account_identifier, request_identifier, \*\*params) -> Optional[Message] -- client.cloudforce_one.requests.message.delete(message_identifer, \*, account_identifier, request_identifier) -> MessageDeleteResponse -- client.cloudforce_one.requests.message.get(request_identifier, \*, account_identifier, \*\*params) -> SyncSinglePage[Message] +- client.cloudforce_one.requests.message.create(request_id, \*, account_id, \*\*params) -> Optional[Message] +- client.cloudforce_one.requests.message.update(message_id, \*, account_id, request_id, \*\*params) -> Optional[Message] +- client.cloudforce_one.requests.message.delete(message_id, \*, account_id, request_id) -> MessageDeleteResponse +- client.cloudforce_one.requests.message.get(request_id, \*, account_id, \*\*params) -> SyncSinglePage[Message] ### Priority @@ -8657,11 +8905,11 @@ from cloudflare.types.cloudforce_one.requests import ( Methods: -- client.cloudforce_one.requests.priority.create(account_identifier, \*\*params) -> Optional[Priority] -- client.cloudforce_one.requests.priority.update(priority_identifer, \*, account_identifier, \*\*params) -> Optional[Item] -- client.cloudforce_one.requests.priority.delete(priority_identifer, \*, account_identifier) -> PriorityDeleteResponse -- client.cloudforce_one.requests.priority.get(priority_identifer, \*, account_identifier) -> Optional[Item] -- client.cloudforce_one.requests.priority.quota(account_identifier) -> Optional[Quota] +- client.cloudforce_one.requests.priority.create(\*, account_id, \*\*params) -> Optional[Priority] +- client.cloudforce_one.requests.priority.update(priority_id, \*, account_id, \*\*params) -> Optional[Item] +- client.cloudforce_one.requests.priority.delete(priority_id, \*, account_id) -> PriorityDeleteResponse +- client.cloudforce_one.requests.priority.get(priority_id, \*, account_id) -> Optional[Item] +- client.cloudforce_one.requests.priority.quota(\*, account_id) -> Optional[Quota] ### Assets @@ -8678,10 +8926,10 @@ from cloudflare.types.cloudforce_one.requests import ( Methods: -- client.cloudforce_one.requests.assets.create(request_identifier, \*, account_identifier, \*\*params) -> SyncSinglePage[AssetCreateResponse] -- client.cloudforce_one.requests.assets.update(asset_identifer, \*, account_identifier, request_identifier, \*\*params) -> Optional[AssetUpdateResponse] -- client.cloudforce_one.requests.assets.delete(asset_identifer, \*, account_identifier, request_identifier) -> AssetDeleteResponse -- client.cloudforce_one.requests.assets.get(asset_identifer, \*, account_identifier, request_identifier) -> SyncSinglePage[AssetGetResponse] +- client.cloudforce_one.requests.assets.create(request_id, \*, account_id, \*\*params) -> SyncSinglePage[AssetCreateResponse] +- client.cloudforce_one.requests.assets.update(asset_id, \*, account_id, request_id, \*\*params) -> Optional[AssetUpdateResponse] +- client.cloudforce_one.requests.assets.delete(asset_id, \*, account_id, request_id) -> AssetDeleteResponse +- client.cloudforce_one.requests.assets.get(asset_id, \*, account_id, request_id) -> SyncSinglePage[AssetGetResponse] ## ThreatEvents @@ -8690,6 +8938,7 @@ Types: ```python from cloudflare.types.cloudforce_one import ( ThreatEventCreateResponse, + ThreatEventListResponse, ThreatEventDeleteResponse, ThreatEventBulkCreateResponse, ThreatEventEditResponse, @@ -8700,6 +8949,7 @@ from cloudflare.types.cloudforce_one import ( Methods: - client.cloudforce_one.threat_events.create(\*, path_account_id, \*\*params) -> ThreatEventCreateResponse +- client.cloudforce_one.threat_events.list(\*, account_id, \*\*params) -> ThreatEventListResponse - client.cloudforce_one.threat_events.delete(event_id, \*, account_id) -> ThreatEventDeleteResponse - client.cloudforce_one.threat_events.bulk_create(\*, account_id, \*\*params) -> ThreatEventBulkCreateResponse - client.cloudforce_one.threat_events.edit(event_id, \*, account_id, \*\*params) -> ThreatEventEditResponse @@ -9103,6 +9353,7 @@ Types: from cloudflare.types.workflows import ( WorkflowUpdateResponse, WorkflowListResponse, + WorkflowDeleteResponse, WorkflowGetResponse, ) ``` @@ -9111,6 +9362,7 @@ Methods: - client.workflows.update(workflow_name, \*, account_id, \*\*params) -> WorkflowUpdateResponse - client.workflows.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[WorkflowListResponse] +- client.workflows.delete(workflow_name, \*, account_id) -> WorkflowDeleteResponse - client.workflows.get(workflow_name, \*, account_id) -> WorkflowGetResponse ## Instances @@ -9145,6 +9397,18 @@ Methods: - client.workflows.instances.status.edit(instance_id, \*, account_id, workflow_name, \*\*params) -> StatusEditResponse +### Events + +Types: + +```python +from cloudflare.types.workflows.instances import EventCreateResponse +``` + +Methods: + +- client.workflows.instances.events.create(event_type, \*, account_id, workflow_name, instance_id, \*\*params) -> object + ## Versions Types: @@ -9520,6 +9784,42 @@ Methods: - client.browser_rendering.snapshot.create(\*, account_id, \*\*params) -> Optional[SnapshotCreateResponse] +## Json + +Types: + +```python +from cloudflare.types.browser_rendering import JsonCreateResponse +``` + +Methods: + +- client.browser_rendering.json.create(\*, account_id, \*\*params) -> JsonCreateResponse + +## Links + +Types: + +```python +from cloudflare.types.browser_rendering import LinkCreateResponse +``` + +Methods: + +- client.browser_rendering.links.create(\*, account_id, \*\*params) -> LinkCreateResponse + +## Markdown + +Types: + +```python +from cloudflare.types.browser_rendering import MarkdownCreateResponse +``` + +Methods: + +- client.browser_rendering.markdown.create(\*, account_id, \*\*params) -> str + # CustomPages Types: @@ -9537,3 +9837,146 @@ Methods: - client.custom_pages.update(identifier, \*, account_id, zone_id, \*\*params) -> Optional[CustomPageUpdateResponse] - client.custom_pages.list(\*, account_id, zone_id) -> SyncSinglePage[object] - client.custom_pages.get(identifier, \*, account_id, zone_id) -> Optional[CustomPageGetResponse] + +# SecretsStore + +## Stores + +Types: + +```python +from cloudflare.types.secrets_store import ( + StoreCreateResponse, + StoreListResponse, + StoreDeleteResponse, +) +``` + +Methods: + +- client.secrets_store.stores.create(\*, account_id, \*\*params) -> SyncSinglePage[StoreCreateResponse] +- client.secrets_store.stores.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[StoreListResponse] +- client.secrets_store.stores.delete(store_id, \*, account_id) -> Optional[StoreDeleteResponse] + +### Secrets + +Types: + +```python +from cloudflare.types.secrets_store.stores import ( + SecretCreateResponse, + SecretListResponse, + SecretDeleteResponse, + SecretBulkDeleteResponse, + SecretDuplicateResponse, + SecretEditResponse, + SecretGetResponse, +) +``` + +Methods: + +- client.secrets_store.stores.secrets.create(store_id, \*, account_id, \*\*params) -> SyncSinglePage[SecretCreateResponse] +- client.secrets_store.stores.secrets.list(store_id, \*, account_id, \*\*params) -> SyncV4PagePaginationArray[SecretListResponse] +- client.secrets_store.stores.secrets.delete(secret_id, \*, account_id, store_id) -> Optional[SecretDeleteResponse] +- client.secrets_store.stores.secrets.bulk_delete(store_id, \*, account_id) -> SyncSinglePage[SecretBulkDeleteResponse] +- client.secrets_store.stores.secrets.duplicate(secret_id, \*, account_id, store_id, \*\*params) -> Optional[SecretDuplicateResponse] +- client.secrets_store.stores.secrets.edit(secret_id, \*, account_id, store_id, \*\*params) -> Optional[SecretEditResponse] +- client.secrets_store.stores.secrets.get(secret_id, \*, account_id, store_id) -> Optional[SecretGetResponse] + +## Quota + +Types: + +```python +from cloudflare.types.secrets_store import QuotaGetResponse +``` + +Methods: + +- client.secrets_store.quota.get(\*, account_id) -> Optional[QuotaGetResponse] + +# Pipelines + +Types: + +```python +from cloudflare.types.pipelines import ( + PipelineCreateResponse, + PipelineUpdateResponse, + PipelineListResponse, + PipelineGetResponse, +) +``` + +Methods: + +- client.pipelines.create(\*, account_id, \*\*params) -> PipelineCreateResponse +- client.pipelines.update(pipeline_name, \*, account_id, \*\*params) -> PipelineUpdateResponse +- client.pipelines.list(\*, account_id, \*\*params) -> PipelineListResponse +- client.pipelines.delete(pipeline_name, \*, account_id) -> None +- client.pipelines.get(pipeline_name, \*, account_id) -> PipelineGetResponse + +# SchemaValidation + +## Schemas + +Types: + +```python +from cloudflare.types.schema_validation import ( + SchemaCreateResponse, + SchemaListResponse, + SchemaDeleteResponse, + SchemaEditResponse, + SchemaGetResponse, +) +``` + +Methods: + +- client.schema_validation.schemas.create(\*, zone_id, \*\*params) -> SchemaCreateResponse +- client.schema_validation.schemas.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[SchemaListResponse] +- client.schema_validation.schemas.delete(schema_id, \*, zone_id) -> SchemaDeleteResponse +- client.schema_validation.schemas.edit(schema_id, \*, zone_id, \*\*params) -> SchemaEditResponse +- client.schema_validation.schemas.get(schema_id, \*, zone_id, \*\*params) -> SchemaGetResponse + +## Settings + +Types: + +```python +from cloudflare.types.schema_validation import ( + SettingUpdateResponse, + SettingEditResponse, + SettingGetResponse, +) +``` + +Methods: + +- client.schema_validation.settings.update(\*, zone_id, \*\*params) -> SettingUpdateResponse +- client.schema_validation.settings.edit(\*, zone_id, \*\*params) -> SettingEditResponse +- client.schema_validation.settings.get(\*, zone_id) -> SettingGetResponse + +### Operations + +Types: + +```python +from cloudflare.types.schema_validation.settings import ( + OperationUpdateResponse, + OperationListResponse, + OperationDeleteResponse, + OperationBulkEditResponse, + OperationGetResponse, +) +``` + +Methods: + +- client.schema_validation.settings.operations.update(operation_id, \*, zone_id, \*\*params) -> OperationUpdateResponse +- client.schema_validation.settings.operations.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[OperationListResponse] +- client.schema_validation.settings.operations.delete(operation_id, \*, zone_id) -> OperationDeleteResponse +- client.schema_validation.settings.operations.bulk_edit(\*, zone_id, \*\*params) -> OperationBulkEditResponse +- client.schema_validation.settings.operations.get(operation_id, \*, zone_id) -> OperationGetResponse diff --git a/examples/workers/script_upload.py b/examples/workers/script_upload.py new file mode 100644 index 00000000000..f6b7fd64efc --- /dev/null +++ b/examples/workers/script_upload.py @@ -0,0 +1,98 @@ +"""Workers Script Upload Example + +Generate an API token: +https://developers.cloudflare.com/fundamentals/api/get-started/create-token/ +(Not Global API Key!) + +Find your account id: +https://developers.cloudflare.com/fundamentals/setup/find-account-and-zone-ids/ + +Set these environment variables: +- CLOUDFLARE_API_TOKEN +- CLOUDFLARE_ACCOUNT_ID + + +### Workers for Platforms ### + +For uploading a User Worker to a dispatch namespace: +https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/ + +Change the entire "script = " line to the following: +"script = client.workers_for_platforms.dispatch.namespaces.scripts.update(" + +Then, define a "dispatch_namespace_name" variable and add a +"dispatch_namespace=dispatch_namespace_name" keyword argument to the "update" method. +""" + +import os +import json + +from cloudflare import Cloudflare, BadRequestError + +API_TOKEN = os.environ.get("CLOUDFLARE_API_TOKEN") +if API_TOKEN is None: + raise RuntimeError("Please set envar CLOUDFLARE_API_TOKEN") + +ACCOUNT_ID = os.environ.get("CLOUDFLARE_ACCOUNT_ID") +if ACCOUNT_ID is None: + raise RuntimeError("Please set envar CLOUDFLARE_ACCOUNT_ID") + +client = Cloudflare(api_token=API_TOKEN) + + +def main() -> None: + """Workers Script Upload Example""" + + script_name = "my-hello-world-script" + script_file_name = f"{script_name}.mjs" + + # Workers Scripts prefer Module Syntax + # https://blog.cloudflare.com/workers-javascript-modules/ + script_content = """ + export default { + async fetch(request, env, ctx) { + return new Response(env.MESSAGE, { status: 200 }); + } + }; + """ + + try: + # https://developers.cloudflare.com/api/resources/workers/subresources/scripts/methods/update/ + script = client.workers.scripts.update( + script_name, + account_id=ACCOUNT_ID, # type: ignore + # https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/ + metadata={ + "main_module": script_file_name, + "bindings": [ + { + "type": "plain_text", + "name": "MESSAGE", + "text": "Hello World!", + } + ], + }, + files={ + # Add main_module file + script_file_name: ( + script_file_name, + bytes(script_content, "utf-8"), + "application/javascript+module", + ) + # Can add other files, such as more modules or source maps + # source_map_file_name: ( + # source_map_file_name, + # bytes(source_map_content, "utf-8"), + # "application/source-map" + #) + }, + ) + print("Script Upload success!") + print(json.dumps(script, indent=2)) + except BadRequestError as err: + print("Script Upload failure!") + print(err) + + +if __name__ == "__main__": + main() diff --git a/pyproject.toml b/pyproject.toml index 94e2b8e68f3..4b50076ca14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "cloudflare" -version = "4.1.0" +version = "4.2.0" description = "The official Python library for the cloudflare API" dynamic = ["readme"] license = "Apache-2.0" @@ -42,7 +42,7 @@ Repository = "https://github.com/cloudflare/cloudflare-python" managed = true # version pins are in requirements-dev.lock dev-dependencies = [ - "pyright>=1.1.359", + "pyright==1.1.399", "mypy", "respx", "pytest", @@ -147,11 +147,10 @@ exclude = [ ] reportImplicitOverride = true +reportOverlappingOverload = false reportImportCycles = false reportPrivateUsage = false -reportOverlappingOverload = false - [tool.ruff] line-length = 120 diff --git a/requirements-dev.lock b/requirements-dev.lock index 91579dc20f6..0e7026b775d 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -69,7 +69,7 @@ pydantic-core==2.27.1 # via pydantic pygments==2.18.0 # via rich -pyright==1.1.392.post0 +pyright==1.1.399 pytest==8.3.3 # via pytest-asyncio pytest-asyncio==0.24.0 diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh new file mode 100755 index 00000000000..6ba857e8d3b --- /dev/null +++ b/scripts/utils/upload-artifact.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -exuo pipefail + +RESPONSE=$(curl -X POST "$URL" \ + -H "Authorization: Bearer $AUTH" \ + -H "Content-Type: application/json") + +SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url') + +if [[ "$SIGNED_URL" == "null" ]]; then + echo -e "\033[31mFailed to get signed URL.\033[0m" + exit 1 +fi + +UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \ + -H "Content-Type: application/gzip" \ + --data-binary @- "$SIGNED_URL" 2>&1) + +if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then + echo -e "\033[32mUploaded build to Stainless storage.\033[0m" + echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/cloudflare-python/$SHA'\033[0m" +else + echo -e "\033[31mFailed to upload artifact.\033[0m" + exit 1 +fi diff --git a/src/cloudflare/__init__.py b/src/cloudflare/__init__.py index 1f9f28fd3c0..9ce8e45d0c0 100644 --- a/src/cloudflare/__init__.py +++ b/src/cloudflare/__init__.py @@ -1,5 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +import typing as _t + from . import types from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes from ._utils import file_from_path @@ -78,6 +80,9 @@ "DefaultAsyncHttpxClient", ] +if not _t.TYPE_CHECKING: + from ._utils._resources_proxy import resources as resources + _setup_logging() # Update the __module__ attribute for exported symbols so that diff --git a/src/cloudflare/_base_client.py b/src/cloudflare/_base_client.py index 649c86dfde8..912a4de8ebb 100644 --- a/src/cloudflare/_base_client.py +++ b/src/cloudflare/_base_client.py @@ -54,11 +54,13 @@ PostParser, RequestFiles, HttpxSendArgs, + HttpxFileTypes, RequestOptions, + MultipartSyntax, HttpxRequestFiles, ModelBuilderProtocol, ) -from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping +from ._utils import is_dict, is_list, asyncify, is_given, is_tuple, lru_cache, is_mapping, is_mapping_t, is_sequence_t from ._compat import PYDANTIC_V2, model_copy, model_dump from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type from ._response import ( @@ -98,7 +100,11 @@ _AsyncStreamT = TypeVar("_AsyncStreamT", bound=AsyncStream[Any]) if TYPE_CHECKING: - from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT + from httpx._config import ( + DEFAULT_TIMEOUT_CONFIG, # pyright: ignore[reportPrivateImportUsage] + ) + + HTTPX_DEFAULT_TIMEOUT = DEFAULT_TIMEOUT_CONFIG else: try: from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT @@ -115,6 +121,7 @@ class PageInfo: url: URL | NotGiven params: Query | NotGiven + json: Body | NotGiven @overload def __init__( @@ -130,19 +137,30 @@ def __init__( params: Query, ) -> None: ... + @overload + def __init__( + self, + *, + json: Body, + ) -> None: ... + def __init__( self, *, url: URL | NotGiven = NOT_GIVEN, + json: Body | NotGiven = NOT_GIVEN, params: Query | NotGiven = NOT_GIVEN, ) -> None: self.url = url + self.json = json self.params = params @override def __repr__(self) -> str: if self.url: return f"{self.__class__.__name__}(url={self.url})" + if self.json: + return f"{self.__class__.__name__}(json={self.json})" return f"{self.__class__.__name__}(params={self.params})" @@ -191,6 +209,19 @@ def _info_to_options(self, info: PageInfo) -> FinalRequestOptions: options.url = str(url) return options + if not isinstance(info.json, NotGiven): + if not is_mapping(info.json): + raise TypeError("Pagination is only supported with mappings") + + if not options.json_data: + options.json_data = {**info.json} + else: + if not is_mapping(options.json_data): + raise TypeError("Pagination is only supported with mappings") + + options.json_data = {**options.json_data, **info.json} + return options + raise ValueError("Unexpected PageInfo state") @@ -331,6 +362,7 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]): _client: _HttpxClientT _version: str _base_url: URL + _api_version: str max_retries: int timeout: Union[float, Timeout, None] _strict_response_validation: bool @@ -342,6 +374,7 @@ def __init__( *, version: str, base_url: str | URL, + api_version: str, _strict_response_validation: bool, max_retries: int = DEFAULT_MAX_RETRIES, timeout: float | Timeout | None = DEFAULT_TIMEOUT, @@ -350,6 +383,7 @@ def __init__( ) -> None: self._version = version self._base_url = self._enforce_trailing_slash(URL(base_url)) + self.api_version = api_version self.max_retries = max_retries self.timeout = timeout self._custom_headers = custom_headers or {} @@ -408,8 +442,8 @@ def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0 headers = httpx.Headers(headers_dict) idempotency_header = self._idempotency_header - if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers: - headers[idempotency_header] = options.idempotency_key or self._idempotency_key() + if idempotency_header and options.idempotency_key and idempotency_header not in headers: + headers[idempotency_header] = options.idempotency_key # Don't set these headers if they were already set or removed by the caller. We check # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case. @@ -423,6 +457,8 @@ def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0 if timeout is not None: headers["x-stainless-read-timeout"] = str(timeout) + headers["api-version"] = self.api_version + return headers def _prepare_url(self, url: str) -> URL: @@ -484,7 +520,24 @@ def _build_request( raise TypeError( f"Expected query input to be a dictionary for multipart requests but got {type(json_data)} instead." ) - kwargs["data"] = self._serialize_multipartform(json_data) + + if options.multipart_syntax == 'json': + json_data = cast("Mapping[str, object]", json_data) + if is_mapping_t(files): + files = { + **files, + **self._serialize_multiapartform_json(json_data), + } + elif is_sequence_t(files): + files = [ + *files, + *self._serialize_multiapartform_json(json_data).items(), + ] + else: + assert not files, "this case should only be hit when there are no files" + files = self._serialize_multiapartform_json(json_data) + else: + kwargs["data"] = self._serialize_multipartform(json_data) # httpx determines whether or not to send a "multipart/form-data" # request based on the truthiness of the "files" argument. @@ -516,6 +569,22 @@ def _build_request( **kwargs, ) + def _serialize_multiapartform_json(self, data: Mapping[str, object]) -> dict[str, HttpxFileTypes]: + serialized: dict[str, HttpxFileTypes] = {} + for key, value in data.items(): + if isinstance(value, Mapping) or is_list(value) or is_tuple(value): + serialized[key] = (None, json.dumps(value).encode("utf-8"), "application/json") + else: + serialized[key] = ( + None, + self.qs._primitive_value_to_str( + value # type: ignore + ).encode("utf-8"), + "text/plain", + ) + + return serialized + def _serialize_multipartform(self, data: Mapping[object, object]) -> dict[str, object]: items = self.qs.stringify_items( # TODO: type ignore is required as stringify_items is well typed but we can't be @@ -785,6 +854,7 @@ def __init__( *, version: str, base_url: str | URL, + api_version: str, max_retries: int = DEFAULT_MAX_RETRIES, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, http_client: httpx.Client | None = None, @@ -815,6 +885,7 @@ def __init__( # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), base_url=base_url, + api_version=api_version, max_retries=max_retries, custom_query=custom_query, custom_headers=custom_headers, @@ -873,7 +944,6 @@ def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: Literal[True], stream_cls: Type[_StreamT], @@ -884,7 +954,6 @@ def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: Literal[False] = False, ) -> ResponseT: ... @@ -894,7 +963,6 @@ def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: bool = False, stream_cls: Type[_StreamT] | None = None, @@ -904,121 +972,109 @@ def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: bool = False, stream_cls: type[_StreamT] | None = None, ) -> ResponseT | _StreamT: - if remaining_retries is not None: - retries_taken = options.get_max_retries(self.max_retries) - remaining_retries - else: - retries_taken = 0 - - return self._request( - cast_to=cast_to, - options=options, - stream=stream, - stream_cls=stream_cls, - retries_taken=retries_taken, - ) + cast_to = self._maybe_override_cast_to(cast_to, options) - def _request( - self, - *, - cast_to: Type[ResponseT], - options: FinalRequestOptions, - retries_taken: int, - stream: bool, - stream_cls: type[_StreamT] | None, - ) -> ResponseT | _StreamT: # create a copy of the options we were given so that if the # options are mutated later & we then retry, the retries are # given the original options input_options = model_copy(options) + if input_options.idempotency_key is None and input_options.method.lower() != "get": + # ensure the idempotency key is reused between requests + input_options.idempotency_key = self._idempotency_key() - cast_to = self._maybe_override_cast_to(cast_to, options) - options = self._prepare_options(options) - - remaining_retries = options.get_max_retries(self.max_retries) - retries_taken - request = self._build_request(options, retries_taken=retries_taken) - self._prepare_request(request) + response: httpx.Response | None = None + max_retries = input_options.get_max_retries(self.max_retries) - kwargs: HttpxSendArgs = {} - if self.custom_auth is not None: - kwargs["auth"] = self.custom_auth + retries_taken = 0 + for retries_taken in range(max_retries + 1): + options = model_copy(input_options) + options = self._prepare_options(options) - log.debug("Sending HTTP Request: %s %s", request.method, request.url) + remaining_retries = max_retries - retries_taken + request = self._build_request(options, retries_taken=retries_taken) + self._prepare_request(request) - try: - response = self._client.send( - request, - stream=stream or self._should_stream_response_body(request=request), - **kwargs, - ) - except httpx.TimeoutException as err: - log.debug("Encountered httpx.TimeoutException", exc_info=True) - - if remaining_retries > 0: - return self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - stream=stream, - stream_cls=stream_cls, - response_headers=None, - ) + kwargs: HttpxSendArgs = {} + if self.custom_auth is not None: + kwargs["auth"] = self.custom_auth - log.debug("Raising timeout error") - raise APITimeoutError(request=request) from err - except Exception as err: - log.debug("Encountered Exception", exc_info=True) + log.debug("Sending HTTP Request: %s %s", request.method, request.url) - if remaining_retries > 0: - return self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - stream=stream, - stream_cls=stream_cls, - response_headers=None, + response = None + try: + response = self._client.send( + request, + stream=stream or self._should_stream_response_body(request=request), + **kwargs, ) + except httpx.TimeoutException as err: + log.debug("Encountered httpx.TimeoutException", exc_info=True) + + if remaining_retries > 0: + self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising timeout error") + raise APITimeoutError(request=request) from err + except Exception as err: + log.debug("Encountered Exception", exc_info=True) + + if remaining_retries > 0: + self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising connection error") + raise APIConnectionError(request=request) from err + + log.debug( + 'HTTP Response: %s %s "%i %s" %s', + request.method, + request.url, + response.status_code, + response.reason_phrase, + response.headers, + ) - log.debug("Raising connection error") - raise APIConnectionError(request=request) from err - - log.debug( - 'HTTP Response: %s %s "%i %s" %s', - request.method, - request.url, - response.status_code, - response.reason_phrase, - response.headers, - ) + try: + response.raise_for_status() + except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code + log.debug("Encountered httpx.HTTPStatusError", exc_info=True) + + if remaining_retries > 0 and self._should_retry(err.response): + err.response.close() + self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=response, + ) + continue - try: - response.raise_for_status() - except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code - log.debug("Encountered httpx.HTTPStatusError", exc_info=True) - - if remaining_retries > 0 and self._should_retry(err.response): - err.response.close() - return self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - response_headers=err.response.headers, - stream=stream, - stream_cls=stream_cls, - ) + # If the response is streamed then we need to explicitly read the response + # to completion before attempting to access the response text. + if not err.response.is_closed: + err.response.read() - # If the response is streamed then we need to explicitly read the response - # to completion before attempting to access the response text. - if not err.response.is_closed: - err.response.read() + log.debug("Re-raising status error") + raise self._make_status_error_from_response(err.response) from None - log.debug("Re-raising status error") - raise self._make_status_error_from_response(err.response) from None + break + assert response is not None, "could not resolve response (should never happen)" return self._process_response( cast_to=cast_to, options=options, @@ -1028,37 +1084,20 @@ def _request( retries_taken=retries_taken, ) - def _retry_request( - self, - options: FinalRequestOptions, - cast_to: Type[ResponseT], - *, - retries_taken: int, - response_headers: httpx.Headers | None, - stream: bool, - stream_cls: type[_StreamT] | None, - ) -> ResponseT | _StreamT: - remaining_retries = options.get_max_retries(self.max_retries) - retries_taken + def _sleep_for_retry( + self, *, retries_taken: int, max_retries: int, options: FinalRequestOptions, response: httpx.Response | None + ) -> None: + remaining_retries = max_retries - retries_taken if remaining_retries == 1: log.debug("1 retry left") else: log.debug("%i retries left", remaining_retries) - timeout = self._calculate_retry_timeout(remaining_retries, options, response_headers) + timeout = self._calculate_retry_timeout(remaining_retries, options, response.headers if response else None) log.info("Retrying request to %s in %f seconds", options.url, timeout) - # In a synchronous context we are blocking the entire thread. Up to the library user to run the client in a - # different thread if necessary. time.sleep(timeout) - return self._request( - options=options, - cast_to=cast_to, - retries_taken=retries_taken + 1, - stream=stream, - stream_cls=stream_cls, - ) - def _process_response( self, *, @@ -1315,6 +1354,7 @@ def __init__( *, version: str, base_url: str | URL, + api_version: str, _strict_response_validation: bool, max_retries: int = DEFAULT_MAX_RETRIES, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, @@ -1343,6 +1383,7 @@ def __init__( super().__init__( version=version, base_url=base_url, + api_version=api_version, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), max_retries=max_retries, @@ -1402,7 +1443,6 @@ async def request( options: FinalRequestOptions, *, stream: Literal[False] = False, - remaining_retries: Optional[int] = None, ) -> ResponseT: ... @overload @@ -1413,7 +1453,6 @@ async def request( *, stream: Literal[True], stream_cls: type[_AsyncStreamT], - remaining_retries: Optional[int] = None, ) -> _AsyncStreamT: ... @overload @@ -1424,7 +1463,6 @@ async def request( *, stream: bool, stream_cls: type[_AsyncStreamT] | None = None, - remaining_retries: Optional[int] = None, ) -> ResponseT | _AsyncStreamT: ... async def request( @@ -1434,116 +1472,111 @@ async def request( *, stream: bool = False, stream_cls: type[_AsyncStreamT] | None = None, - remaining_retries: Optional[int] = None, - ) -> ResponseT | _AsyncStreamT: - if remaining_retries is not None: - retries_taken = options.get_max_retries(self.max_retries) - remaining_retries - else: - retries_taken = 0 - - return await self._request( - cast_to=cast_to, - options=options, - stream=stream, - stream_cls=stream_cls, - retries_taken=retries_taken, - ) - - async def _request( - self, - cast_to: Type[ResponseT], - options: FinalRequestOptions, - *, - stream: bool, - stream_cls: type[_AsyncStreamT] | None, - retries_taken: int, ) -> ResponseT | _AsyncStreamT: if self._platform is None: # `get_platform` can make blocking IO calls so we # execute it earlier while we are in an async context self._platform = await asyncify(get_platform)() + cast_to = self._maybe_override_cast_to(cast_to, options) + # create a copy of the options we were given so that if the # options are mutated later & we then retry, the retries are # given the original options input_options = model_copy(options) + if input_options.idempotency_key is None and input_options.method.lower() != "get": + # ensure the idempotency key is reused between requests + input_options.idempotency_key = self._idempotency_key() - cast_to = self._maybe_override_cast_to(cast_to, options) - options = await self._prepare_options(options) + response: httpx.Response | None = None + max_retries = input_options.get_max_retries(self.max_retries) - remaining_retries = options.get_max_retries(self.max_retries) - retries_taken - request = self._build_request(options, retries_taken=retries_taken) - await self._prepare_request(request) + retries_taken = 0 + for retries_taken in range(max_retries + 1): + options = model_copy(input_options) + options = await self._prepare_options(options) - kwargs: HttpxSendArgs = {} - if self.custom_auth is not None: - kwargs["auth"] = self.custom_auth + remaining_retries = max_retries - retries_taken + request = self._build_request(options, retries_taken=retries_taken) + await self._prepare_request(request) - try: - response = await self._client.send( - request, - stream=stream or self._should_stream_response_body(request=request), - **kwargs, - ) - except httpx.TimeoutException as err: - log.debug("Encountered httpx.TimeoutException", exc_info=True) + kwargs: HttpxSendArgs = {} + if self.custom_auth is not None: + kwargs["auth"] = self.custom_auth - if remaining_retries > 0: - return await self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - stream=stream, - stream_cls=stream_cls, - response_headers=None, - ) + log.debug("Sending HTTP Request: %s %s", request.method, request.url) - log.debug("Raising timeout error") - raise APITimeoutError(request=request) from err - except Exception as err: - log.debug("Encountered Exception", exc_info=True) - - if remaining_retries > 0: - return await self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - stream=stream, - stream_cls=stream_cls, - response_headers=None, + response = None + try: + response = await self._client.send( + request, + stream=stream or self._should_stream_response_body(request=request), + **kwargs, ) + except httpx.TimeoutException as err: + log.debug("Encountered httpx.TimeoutException", exc_info=True) + + if remaining_retries > 0: + await self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising timeout error") + raise APITimeoutError(request=request) from err + except Exception as err: + log.debug("Encountered Exception", exc_info=True) + + if remaining_retries > 0: + await self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising connection error") + raise APIConnectionError(request=request) from err + + log.debug( + 'HTTP Response: %s %s "%i %s" %s', + request.method, + request.url, + response.status_code, + response.reason_phrase, + response.headers, + ) - log.debug("Raising connection error") - raise APIConnectionError(request=request) from err + try: + response.raise_for_status() + except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code + log.debug("Encountered httpx.HTTPStatusError", exc_info=True) + + if remaining_retries > 0 and self._should_retry(err.response): + await err.response.aclose() + await self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=response, + ) + continue - log.debug( - 'HTTP Request: %s %s "%i %s"', request.method, request.url, response.status_code, response.reason_phrase - ) + # If the response is streamed then we need to explicitly read the response + # to completion before attempting to access the response text. + if not err.response.is_closed: + await err.response.aread() - try: - response.raise_for_status() - except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code - log.debug("Encountered httpx.HTTPStatusError", exc_info=True) - - if remaining_retries > 0 and self._should_retry(err.response): - await err.response.aclose() - return await self._retry_request( - input_options, - cast_to, - retries_taken=retries_taken, - response_headers=err.response.headers, - stream=stream, - stream_cls=stream_cls, - ) + log.debug("Re-raising status error") + raise self._make_status_error_from_response(err.response) from None - # If the response is streamed then we need to explicitly read the response - # to completion before attempting to access the response text. - if not err.response.is_closed: - await err.response.aread() - - log.debug("Re-raising status error") - raise self._make_status_error_from_response(err.response) from None + break + assert response is not None, "could not resolve response (should never happen)" return await self._process_response( cast_to=cast_to, options=options, @@ -1553,35 +1586,20 @@ async def _request( retries_taken=retries_taken, ) - async def _retry_request( - self, - options: FinalRequestOptions, - cast_to: Type[ResponseT], - *, - retries_taken: int, - response_headers: httpx.Headers | None, - stream: bool, - stream_cls: type[_AsyncStreamT] | None, - ) -> ResponseT | _AsyncStreamT: - remaining_retries = options.get_max_retries(self.max_retries) - retries_taken + async def _sleep_for_retry( + self, *, retries_taken: int, max_retries: int, options: FinalRequestOptions, response: httpx.Response | None + ) -> None: + remaining_retries = max_retries - retries_taken if remaining_retries == 1: log.debug("1 retry left") else: log.debug("%i retries left", remaining_retries) - timeout = self._calculate_retry_timeout(remaining_retries, options, response_headers) + timeout = self._calculate_retry_timeout(remaining_retries, options, response.headers if response else None) log.info("Retrying request to %s in %f seconds", options.url, timeout) await anyio.sleep(timeout) - return await self._request( - options=options, - cast_to=cast_to, - retries_taken=retries_taken + 1, - stream=stream, - stream_cls=stream_cls, - ) - async def _process_response( self, *, @@ -1794,6 +1812,7 @@ def make_request_options( idempotency_key: str | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, post_parser: PostParser | NotGiven = NOT_GIVEN, + multipart_syntax: MultipartSyntax | None = None, ) -> RequestOptions: """Create a dict of type RequestOptions without keys of NotGiven values.""" options: RequestOptions = {} @@ -1819,6 +1838,9 @@ def make_request_options( # internal options["post_parser"] = post_parser # type: ignore + if multipart_syntax is not None: + options["multipart_syntax"] = multipart_syntax + return options diff --git a/src/cloudflare/_client.py b/src/cloudflare/_client.py index f3a20643345..141eaf0be63 100644 --- a/src/cloudflare/_client.py +++ b/src/cloudflare/_client.py @@ -4,6 +4,7 @@ import os from typing import TYPE_CHECKING, Any, Union, Mapping +from datetime import datetime from typing_extensions import Self, override import httpx @@ -20,10 +21,7 @@ ProxiesTypes, RequestOptions, ) -from ._utils import ( - is_given, - get_async_library, -) +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 @@ -73,6 +71,7 @@ snippets, spectrum, hostnames, + pipelines, registrar, turnstile, vectorize, @@ -97,6 +96,7 @@ abuse_reports, email_routing, magic_transit, + secrets_store, waiting_rooms, bot_management, cloudforce_one, @@ -113,6 +113,7 @@ resource_sharing, browser_rendering, mtls_certificates, + schema_validation, url_normalization, custom_nameservers, managed_transforms, @@ -142,6 +143,7 @@ from .resources.ssl.ssl import SSLResource, AsyncSSLResource from .resources.argo.argo import ArgoResource, AsyncArgoResource from .resources.logs.logs import LogsResource, AsyncLogsResource + from .resources.pipelines import PipelinesResource, AsyncPipelinesResource from .resources.user.user import UserResource, AsyncUserResource from .resources.web3.web3 import Web3Resource, AsyncWeb3Resource from .resources.audit_logs import AuditLogsResource, AsyncAuditLogsResource @@ -199,6 +201,7 @@ from .resources.healthchecks.healthchecks import HealthchecksResource, AsyncHealthchecksResource from .resources.email_routing.email_routing import EmailRoutingResource, AsyncEmailRoutingResource from .resources.magic_transit.magic_transit import MagicTransitResource, AsyncMagicTransitResource + 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 @@ -216,6 +219,7 @@ from .resources.resource_sharing.resource_sharing import ResourceSharingResource, AsyncResourceSharingResource 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, @@ -276,6 +280,7 @@ def __init__( api_email: str | None = None, user_service_key: str | None = None, base_url: str | httpx.URL | None = None, + api_version: str | None = None, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, @@ -323,9 +328,13 @@ def __init__( 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, @@ -886,6 +895,24 @@ def custom_pages(self) -> 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 with_raw_response(self) -> CloudflareWithRawResponse: return CloudflareWithRawResponse(self) @@ -985,6 +1012,7 @@ def copy( 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, http_client: httpx.Client | None = None, max_retries: int | NotGiven = NOT_GIVEN, @@ -1022,6 +1050,7 @@ def copy( api_email=api_email or self.api_email, user_service_key=user_service_key or self.user_service_key, base_url=base_url or self.base_url, + api_version=api_version or self.api_version, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, max_retries=max_retries if is_given(max_retries) else self.max_retries, @@ -1083,6 +1112,7 @@ def __init__( api_email: str | None = None, user_service_key: str | None = None, base_url: str | httpx.URL | None = None, + api_version: str | None = None, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, @@ -1130,9 +1160,13 @@ def __init__( 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, @@ -1693,6 +1727,24 @@ def custom_pages(self) -> AsyncCustomPagesResource: return AsyncCustomPagesResource(self) + @cached_property + def secrets_store(self) -> AsyncSecretsStoreResource: + from .resources.secrets_store import AsyncSecretsStoreResource + + return AsyncSecretsStoreResource(self) + + @cached_property + def pipelines(self) -> AsyncPipelinesResource: + from .resources.pipelines import AsyncPipelinesResource + + return AsyncPipelinesResource(self) + + @cached_property + def schema_validation(self) -> AsyncSchemaValidationResource: + from .resources.schema_validation import AsyncSchemaValidationResource + + return AsyncSchemaValidationResource(self) + @cached_property def with_raw_response(self) -> AsyncCloudflareWithRawResponse: return AsyncCloudflareWithRawResponse(self) @@ -1792,6 +1844,7 @@ def copy( 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, http_client: httpx.AsyncClient | None = None, max_retries: int | NotGiven = NOT_GIVEN, @@ -1829,6 +1882,7 @@ def copy( api_email=api_email or self.api_email, user_service_key=user_service_key or self.user_service_key, base_url=base_url or self.base_url, + api_version=api_version or self.api_version, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, max_retries=max_retries if is_given(max_retries) else self.max_retries, @@ -2435,6 +2489,24 @@ def custom_pages(self) -> custom_pages.CustomPagesResourceWithRawResponse: return CustomPagesResourceWithRawResponse(self._client.custom_pages) + @cached_property + def secrets_store(self) -> secrets_store.SecretsStoreResourceWithRawResponse: + from .resources.secrets_store import SecretsStoreResourceWithRawResponse + + return SecretsStoreResourceWithRawResponse(self._client.secrets_store) + + @cached_property + def pipelines(self) -> pipelines.PipelinesResourceWithRawResponse: + from .resources.pipelines import PipelinesResourceWithRawResponse + + return PipelinesResourceWithRawResponse(self._client.pipelines) + + @cached_property + def schema_validation(self) -> schema_validation.SchemaValidationResourceWithRawResponse: + from .resources.schema_validation import SchemaValidationResourceWithRawResponse + + return SchemaValidationResourceWithRawResponse(self._client.schema_validation) + class AsyncCloudflareWithRawResponse: _client: AsyncCloudflare @@ -2996,6 +3068,24 @@ def custom_pages(self) -> custom_pages.AsyncCustomPagesResourceWithRawResponse: return AsyncCustomPagesResourceWithRawResponse(self._client.custom_pages) + @cached_property + def secrets_store(self) -> secrets_store.AsyncSecretsStoreResourceWithRawResponse: + from .resources.secrets_store import AsyncSecretsStoreResourceWithRawResponse + + return AsyncSecretsStoreResourceWithRawResponse(self._client.secrets_store) + + @cached_property + def pipelines(self) -> pipelines.AsyncPipelinesResourceWithRawResponse: + from .resources.pipelines import AsyncPipelinesResourceWithRawResponse + + return AsyncPipelinesResourceWithRawResponse(self._client.pipelines) + + @cached_property + def schema_validation(self) -> schema_validation.AsyncSchemaValidationResourceWithRawResponse: + from .resources.schema_validation import AsyncSchemaValidationResourceWithRawResponse + + return AsyncSchemaValidationResourceWithRawResponse(self._client.schema_validation) + class CloudflareWithStreamedResponse: _client: Cloudflare @@ -3557,6 +3647,24 @@ def custom_pages(self) -> custom_pages.CustomPagesResourceWithStreamingResponse: return CustomPagesResourceWithStreamingResponse(self._client.custom_pages) + @cached_property + def secrets_store(self) -> secrets_store.SecretsStoreResourceWithStreamingResponse: + from .resources.secrets_store import SecretsStoreResourceWithStreamingResponse + + return SecretsStoreResourceWithStreamingResponse(self._client.secrets_store) + + @cached_property + def pipelines(self) -> pipelines.PipelinesResourceWithStreamingResponse: + from .resources.pipelines import PipelinesResourceWithStreamingResponse + + return PipelinesResourceWithStreamingResponse(self._client.pipelines) + + @cached_property + def schema_validation(self) -> schema_validation.SchemaValidationResourceWithStreamingResponse: + from .resources.schema_validation import SchemaValidationResourceWithStreamingResponse + + return SchemaValidationResourceWithStreamingResponse(self._client.schema_validation) + class AsyncCloudflareWithStreamedResponse: _client: AsyncCloudflare @@ -4128,6 +4236,24 @@ def custom_pages(self) -> custom_pages.AsyncCustomPagesResourceWithStreamingResp return AsyncCustomPagesResourceWithStreamingResponse(self._client.custom_pages) + @cached_property + def secrets_store(self) -> secrets_store.AsyncSecretsStoreResourceWithStreamingResponse: + from .resources.secrets_store import AsyncSecretsStoreResourceWithStreamingResponse + + return AsyncSecretsStoreResourceWithStreamingResponse(self._client.secrets_store) + + @cached_property + def pipelines(self) -> pipelines.AsyncPipelinesResourceWithStreamingResponse: + from .resources.pipelines import AsyncPipelinesResourceWithStreamingResponse + + return AsyncPipelinesResourceWithStreamingResponse(self._client.pipelines) + + @cached_property + def schema_validation(self) -> schema_validation.AsyncSchemaValidationResourceWithStreamingResponse: + from .resources.schema_validation import AsyncSchemaValidationResourceWithStreamingResponse + + return AsyncSchemaValidationResourceWithStreamingResponse(self._client.schema_validation) + Client = Cloudflare diff --git a/src/cloudflare/_models.py b/src/cloudflare/_models.py index b51a1bf5f94..669f6bcc00b 100644 --- a/src/cloudflare/_models.py +++ b/src/cloudflare/_models.py @@ -19,7 +19,6 @@ ) import pydantic -import pydantic.generics from pydantic.fields import FieldInfo from ._types import ( @@ -31,6 +30,7 @@ Timeout, NotGiven, AnyMapping, + MultipartSyntax, HttpxRequestFiles, ) from ._utils import ( @@ -627,8 +627,8 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, # Note: if one variant defines an alias then they all should discriminator_alias = field_info.alias - if field_info.annotation and is_literal_type(field_info.annotation): - for entry in get_args(field_info.annotation): + if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation): + for entry in get_args(annotation): if isinstance(entry, str): mapping[entry] = variant @@ -681,7 +681,7 @@ def set_pydantic_config(typ: Any, config: pydantic.ConfigDict) -> None: setattr(typ, "__pydantic_config__", config) # noqa: B010 -# our use of subclasssing here causes weirdness for type checkers, +# our use of subclassing here causes weirdness for type checkers, # so we just pretend that we don't subclass if TYPE_CHECKING: GenericModel = BaseModel @@ -738,6 +738,7 @@ class FinalRequestOptionsInput(TypedDict, total=False): idempotency_key: str json_data: Body extra_json: AnyMapping + multipart_syntax: MultipartSyntax @final @@ -750,6 +751,7 @@ class FinalRequestOptions(pydantic.BaseModel): timeout: Union[float, Timeout, None, NotGiven] = NotGiven() files: Union[HttpxRequestFiles, None] = None idempotency_key: Union[str, None] = None + multipart_syntax: Union[MultipartSyntax, None] = None post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven() # It should be noted that we cannot use `json` here as that would override diff --git a/src/cloudflare/_response.py b/src/cloudflare/_response.py index f20e4379a89..c23d0dd7811 100644 --- a/src/cloudflare/_response.py +++ b/src/cloudflare/_response.py @@ -235,7 +235,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: # split is required to handle cases where additional information is included # in the response, e.g. application/json; charset=utf-8 content_type, *_ = response.headers.get("content-type", "*").split(";") - if content_type != "application/json": + if not content_type.endswith("json"): if is_basemodel(cast_to): try: data = response.json() diff --git a/src/cloudflare/_types.py b/src/cloudflare/_types.py index 0d42772c5b6..81cd5757e17 100644 --- a/src/cloudflare/_types.py +++ b/src/cloudflare/_types.py @@ -71,6 +71,8 @@ ] HttpxRequestFiles = Union[Mapping[str, HttpxFileTypes], Sequence[Tuple[str, HttpxFileTypes]]] +MultipartSyntax = Literal["query", "json"] + # Workaround to support (cast_to: Type[ResponseT]) -> ResponseT # where ResponseT includes `None`. In order to support directly # passing `None`, overloads would have to be defined for every @@ -100,6 +102,7 @@ class RequestOptions(TypedDict, total=False): params: Query extra_json: AnyMapping idempotency_key: str + multipart_syntax: MultipartSyntax # Sentinel class used until PEP 0661 is accepted diff --git a/src/cloudflare/_utils/_proxy.py b/src/cloudflare/_utils/_proxy.py index ffd883e9dde..0f239a33c6d 100644 --- a/src/cloudflare/_utils/_proxy.py +++ b/src/cloudflare/_utils/_proxy.py @@ -46,7 +46,10 @@ def __dir__(self) -> Iterable[str]: @property # type: ignore @override def __class__(self) -> type: # pyright: ignore - proxied = self.__get_proxied__() + try: + proxied = self.__get_proxied__() + except Exception: + return type(self) if issubclass(type(proxied), LazyProxy): return type(proxied) return proxied.__class__ diff --git a/src/cloudflare/_utils/_resources_proxy.py b/src/cloudflare/_utils/_resources_proxy.py new file mode 100644 index 00000000000..f7fa42f9c30 --- /dev/null +++ b/src/cloudflare/_utils/_resources_proxy.py @@ -0,0 +1,24 @@ +from __future__ import annotations + +from typing import Any +from typing_extensions import override + +from ._proxy import LazyProxy + + +class ResourcesProxy(LazyProxy[Any]): + """A proxy for the `cloudflare.resources` module. + + This is used so that we can lazily import `cloudflare.resources` only when + needed *and* so that users can just import `cloudflare` and reference `cloudflare.resources` + """ + + @override + def __load__(self) -> Any: + import importlib + + mod = importlib.import_module("cloudflare.resources") + return mod + + +resources = ResourcesProxy().__as_proxied__() diff --git a/src/cloudflare/_utils/_transform.py b/src/cloudflare/_utils/_transform.py index 18afd9d8bd5..b0cc20a7355 100644 --- a/src/cloudflare/_utils/_transform.py +++ b/src/cloudflare/_utils/_transform.py @@ -5,13 +5,15 @@ import pathlib from typing import Any, Mapping, TypeVar, cast from datetime import date, datetime -from typing_extensions import Literal, get_args, override, get_type_hints +from typing_extensions import Literal, get_args, override, get_type_hints as _get_type_hints import anyio import pydantic from ._utils import ( is_list, + is_given, + lru_cache, is_mapping, is_iterable, ) @@ -108,6 +110,7 @@ class Params(TypedDict, total=False): return cast(_T, transformed) +@lru_cache(maxsize=8096) def _get_annotated_type(type_: type) -> type | None: """If the given type is an `Annotated` type then it is returned, if not `None` is returned. @@ -126,7 +129,7 @@ def _get_annotated_type(type_: type) -> type | None: def _maybe_transform_key(key: str, type_: type) -> str: """Transform the given `data` based on the annotations provided in `type_`. - Note: this function only looks at `Annotated` types that contain `PropertInfo` metadata. + Note: this function only looks at `Annotated` types that contain `PropertyInfo` metadata. """ annotated_type = _get_annotated_type(type_) if annotated_type is None: @@ -142,6 +145,10 @@ def _maybe_transform_key(key: str, type_: type) -> str: return key +def _no_transform_needed(annotation: type) -> bool: + return annotation == float or annotation == int + + def _transform_recursive( data: object, *, @@ -184,6 +191,15 @@ def _transform_recursive( return cast(object, data) inner_type = extract_type_arg(stripped_type, 0) + if _no_transform_needed(inner_type): + # for some types there is no need to transform anything, so we can get a small + # perf boost from skipping that work. + # + # but we still need to convert to a list to ensure the data is json-serializable + if is_list(data): + return data + return list(data) + return [_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] if is_union_type(stripped_type): @@ -245,6 +261,11 @@ def _transform_typeddict( result: dict[str, object] = {} annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): + if not is_given(value): + # we don't need to include `NotGiven` values here as they'll + # be stripped out before the request is sent anyway + continue + type_ = annotations.get(key) if type_ is None: # we do not have a type annotation for this field, leave it as is @@ -332,6 +353,15 @@ async def _async_transform_recursive( return cast(object, data) inner_type = extract_type_arg(stripped_type, 0) + if _no_transform_needed(inner_type): + # for some types there is no need to transform anything, so we can get a small + # perf boost from skipping that work. + # + # but we still need to convert to a list to ensure the data is json-serializable + if is_list(data): + return data + return list(data) + return [await _async_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] if is_union_type(stripped_type): @@ -393,6 +423,11 @@ async def _async_transform_typeddict( result: dict[str, object] = {} annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): + if not is_given(value): + # we don't need to include `NotGiven` values here as they'll + # be stripped out before the request is sent anyway + continue + type_ = annotations.get(key) if type_ is None: # we do not have a type annotation for this field, leave it as is @@ -400,3 +435,13 @@ async def _async_transform_typeddict( else: result[_maybe_transform_key(key, type_)] = await _async_transform_recursive(value, annotation=type_) return result + + +@lru_cache(maxsize=8096) +def get_type_hints( + obj: Any, + globalns: dict[str, Any] | None = None, + localns: Mapping[str, Any] | None = None, + include_extras: bool = False, +) -> dict[str, Any]: + return _get_type_hints(obj, globalns=globalns, localns=localns, include_extras=include_extras) diff --git a/src/cloudflare/_utils/_typing.py b/src/cloudflare/_utils/_typing.py index 278749b1475..1bac9542e20 100644 --- a/src/cloudflare/_utils/_typing.py +++ b/src/cloudflare/_utils/_typing.py @@ -13,6 +13,7 @@ get_origin, ) +from ._utils import lru_cache from .._types import InheritsGeneric from .._compat import is_union as _is_union @@ -66,6 +67,7 @@ def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]: # Extracts T from Annotated[T, ...] or from Required[Annotated[T, ...]] +@lru_cache(maxsize=8096) def strip_annotated_type(typ: type) -> type: if is_required_type(typ) or is_annotated_type(typ): return strip_annotated_type(cast(type, get_args(typ)[0])) @@ -108,7 +110,7 @@ class MyResponse(Foo[_T]): ``` """ cls = cast(object, get_origin(typ) or typ) - if cls in generic_bases: + if cls in generic_bases: # pyright: ignore[reportUnnecessaryContains] # we're given the class directly return extract_type_arg(typ, index) diff --git a/src/cloudflare/_utils/_utils.py b/src/cloudflare/_utils/_utils.py index e5811bba420..ea3cf3f2c38 100644 --- a/src/cloudflare/_utils/_utils.py +++ b/src/cloudflare/_utils/_utils.py @@ -72,8 +72,16 @@ def _extract_items( from .._files import assert_is_file_content # We have exhausted the path, return the entry we found. - assert_is_file_content(obj, key=flattened_key) assert flattened_key is not None + + if is_list(obj): + files: list[tuple[str, FileTypes]] = [] + for entry in obj: + assert_is_file_content(entry, key=flattened_key + "[]" if flattened_key else "") + files.append((flattened_key + "[]", cast(FileTypes, entry))) + return files + + assert_is_file_content(obj, key=flattened_key) return [(flattened_key, cast(FileTypes, obj))] index += 1 diff --git a/src/cloudflare/_version.py b/src/cloudflare/_version.py index 7dd1f280c27..1013e2ad416 100644 --- a/src/cloudflare/_version.py +++ b/src/cloudflare/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "cloudflare" -__version__ = "4.1.0" # x-release-please-version +__version__ = "4.2.0" # x-release-please-version diff --git a/src/cloudflare/resources/abuse_reports.py b/src/cloudflare/resources/abuse_reports.py index 09f63ae53af..e3e3af888d9 100644 --- a/src/cloudflare/resources/abuse_reports.py +++ b/src/cloudflare/resources/abuse_reports.py @@ -8,11 +8,7 @@ import httpx from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - required_args, - maybe_transform, - async_maybe_transform, -) +from .._utils import required_args, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -64,16 +60,6 @@ def create( ], *, account_id: str, - address1: str, - agent_name: str, - agree: Literal[0, 1], - city: str, - country: str, - host_notification: Literal["send", "send-anon", "none"], - original_work: str, - owner_notification: Literal["send", "send-anon", "none"], - signature: str, - state: str, act: Literal[ "abuse_dmca", "abuse_trademark", @@ -83,25 +69,36 @@ def create( "abuse_threat", "abuse_registrar_whois", "abuse_ncsei", - ] - | NotGiven = NOT_GIVEN, + ], + email: str, + email2: str, + name: str, + urls: str, + address1: str | NotGiven = NOT_GIVEN, + agent_name: str | NotGiven = NOT_GIVEN, + agree: Literal[0, 1] | NotGiven = NOT_GIVEN, + city: str | NotGiven = NOT_GIVEN, comments: str | NotGiven = NOT_GIVEN, company: str | NotGiven = NOT_GIVEN, + country: str | NotGiven = NOT_GIVEN, destination_ips: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - email2: str | NotGiven = NOT_GIVEN, + host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, justification: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, + original_work: str | NotGiven = NOT_GIVEN, + owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ports_protocols: str | NotGiven = NOT_GIVEN, + reported_country: str | NotGiven = NOT_GIVEN, + reported_user_agent: str | NotGiven = NOT_GIVEN, + signature: str | NotGiven = NOT_GIVEN, source_ips: str | NotGiven = NOT_GIVEN, + state: str | NotGiven = NOT_GIVEN, tele: str | NotGiven = NOT_GIVEN, title: str | NotGiven = NOT_GIVEN, trademark_number: str | NotGiven = NOT_GIVEN, trademark_office: str | NotGiven = NOT_GIVEN, trademark_symbol: str | NotGiven = NOT_GIVEN, - urls: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -115,74 +112,83 @@ def create( Args: report_type: The abuse report type - address1: Text not exceeding 100 characters. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - - agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field - may be released by Cloudflare to third parties such as the Lumen Database - (https://lumendatabase.org/). - - agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports + act: The abuse report type - city: Text not exceeding 255 characters. This field may be released by Cloudflare to + email: A valid email of the abuse reporter. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). - country: Text not exceeding 255 characters. This field may be released by Cloudflare to + email2: Should match the value provided in `email` + + name: Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). - host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + should not exceed 250 URLs. All URLs should have the same hostname. Each URL + should be unique. This field may be released by Cloudflare to third parties such + as the Lumen Database (https://lumendatabase.org/). - original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to + address1: Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). - owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field + may be released by Cloudflare to third parties such as the Lumen Database + (https://lumendatabase.org/). - signature: Required for DMCA reports, should be same as Name. An affirmation that all - information in the report is true and accurate while agreeing to the policies of - Cloudflare's abuse reports + agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports - state: Text not exceeding 255 characters. This field may be released by Cloudflare to + city: Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). - act: The abuse report type - comments: Any additional comments about the infringement not exceeding 2000 characters company: Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). + country: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). + destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of destination IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique - email: A valid email of the abuse reporter. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - - email2: Should match the value provided in `email` + host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. justification: A detailed description of the infringement, including any necessary access details and the exact steps needed to view the content, not exceeding 5000 characters - name: Text not exceeding 255 characters. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report. + original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). + + owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual port/protocol should not exceed 100 characters. The list should not have more than 30 unique ports and protocols. + reported_country: Text containing 2 characters + + reported_user_agent: Text not exceeding 255 characters + + signature: Required for DMCA reports, should be same as Name. An affirmation that all + information in the report is true and accurate while agreeing to the policies of + Cloudflare's abuse reports + source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique + state: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). + tele: Text not exceeding 20 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). @@ -194,11 +200,6 @@ def create( trademark_symbol: Text not exceeding 1000 characters - urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs - should not exceed 250 URLs. All URLs should have the same hostname. Each URL - should be unique. This field may be released by Cloudflare to third parties such - as the Lumen Database (https://lumendatabase.org/). - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -224,12 +225,6 @@ def create( ], *, account_id: str, - host_notification: Literal["send", "send-anon", "none"], - justification: str, - owner_notification: Literal["send", "send-anon", "none"], - trademark_number: str, - trademark_office: str, - trademark_symbol: str, act: Literal[ "abuse_dmca", "abuse_trademark", @@ -239,8 +234,11 @@ def create( "abuse_threat", "abuse_registrar_whois", "abuse_ncsei", - ] - | NotGiven = NOT_GIVEN, + ], + email: str, + email2: str, + name: str, + urls: str, address1: str | NotGiven = NOT_GIVEN, agent_name: str | NotGiven = NOT_GIVEN, agree: Literal[0, 1] | NotGiven = NOT_GIVEN, @@ -249,19 +247,23 @@ def create( company: str | NotGiven = NOT_GIVEN, country: str | NotGiven = NOT_GIVEN, destination_ips: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - email2: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, + host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, + justification: str | NotGiven = NOT_GIVEN, ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, original_work: str | NotGiven = NOT_GIVEN, + owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ports_protocols: str | NotGiven = NOT_GIVEN, + reported_country: str | NotGiven = NOT_GIVEN, + reported_user_agent: str | NotGiven = NOT_GIVEN, signature: str | NotGiven = NOT_GIVEN, source_ips: str | NotGiven = NOT_GIVEN, state: str | NotGiven = NOT_GIVEN, tele: str | NotGiven = NOT_GIVEN, title: str | NotGiven = NOT_GIVEN, - urls: str | NotGiven = NOT_GIVEN, + trademark_number: str | NotGiven = NOT_GIVEN, + trademark_office: str | NotGiven = NOT_GIVEN, + trademark_symbol: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -275,23 +277,20 @@ def create( Args: report_type: The abuse report type - host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. - - justification: A detailed description of the infringement, including any necessary access - details and the exact steps needed to view the content, not exceeding 5000 - characters - - owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + act: The abuse report type - trademark_number: Text not exceeding 1000 characters + email: A valid email of the abuse reporter. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - trademark_office: Text not exceeding 1000 characters + email2: Should match the value provided in `email` - trademark_symbol: Text not exceeding 1000 characters + name: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - act: The abuse report type + urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + should not exceed 250 URLs. All URLs should have the same hostname. Each URL + should be unique. This field may be released by Cloudflare to third parties such + as the Lumen Database (https://lumendatabase.org/). address1: Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). @@ -317,13 +316,12 @@ def create( destination IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique - email: A valid email of the abuse reporter. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - - email2: Should match the value provided in `email` + host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. - name: Text not exceeding 255 characters. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). + justification: A detailed description of the infringement, including any necessary access + details and the exact steps needed to view the content, not exceeding 5000 + characters ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. @@ -333,11 +331,18 @@ def create( original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). + owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual port/protocol should not exceed 100 characters. The list should not have more than 30 unique ports and protocols. + reported_country: Text containing 2 characters + + reported_user_agent: Text not exceeding 255 characters + signature: Required for DMCA reports, should be same as Name. An affirmation that all information in the report is true and accurate while agreeing to the policies of Cloudflare's abuse reports @@ -354,10 +359,11 @@ def create( title: Text not exceeding 255 characters - urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs - should not exceed 250 URLs. All URLs should have the same hostname. Each URL - should be unique. This field may be released by Cloudflare to third parties such - as the Lumen Database (https://lumendatabase.org/). + trademark_number: Text not exceeding 1000 characters + + trademark_office: Text not exceeding 1000 characters + + trademark_symbol: Text not exceeding 1000 characters extra_headers: Send extra headers @@ -384,9 +390,6 @@ def create( ], *, account_id: str, - host_notification: Literal["send", "send-anon", "none"], - justification: str, - owner_notification: Literal["send", "send-anon", "none"], act: Literal[ "abuse_dmca", "abuse_trademark", @@ -396,8 +399,11 @@ def create( "abuse_threat", "abuse_registrar_whois", "abuse_ncsei", - ] - | NotGiven = NOT_GIVEN, + ], + email: str, + email2: str, + name: str, + urls: str, address1: str | NotGiven = NOT_GIVEN, agent_name: str | NotGiven = NOT_GIVEN, agree: Literal[0, 1] | NotGiven = NOT_GIVEN, @@ -406,13 +412,15 @@ def create( company: str | NotGiven = NOT_GIVEN, country: str | NotGiven = NOT_GIVEN, destination_ips: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - email2: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, + host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, + justification: str | NotGiven = NOT_GIVEN, ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, original_work: str | NotGiven = NOT_GIVEN, + owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ports_protocols: str | NotGiven = NOT_GIVEN, + reported_country: str | NotGiven = NOT_GIVEN, + reported_user_agent: str | NotGiven = NOT_GIVEN, signature: str | NotGiven = NOT_GIVEN, source_ips: str | NotGiven = NOT_GIVEN, state: str | NotGiven = NOT_GIVEN, @@ -421,7 +429,6 @@ def create( trademark_number: str | NotGiven = NOT_GIVEN, trademark_office: str | NotGiven = NOT_GIVEN, trademark_symbol: str | NotGiven = NOT_GIVEN, - urls: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -435,17 +442,20 @@ def create( Args: report_type: The abuse report type - host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + act: The abuse report type - justification: A detailed description of the infringement, including any necessary access - details and the exact steps needed to view the content, not exceeding 5000 - characters + email: A valid email of the abuse reporter. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + email2: Should match the value provided in `email` - act: The abuse report type + name: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). + + urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + should not exceed 250 URLs. All URLs should have the same hostname. Each URL + should be unique. This field may be released by Cloudflare to third parties such + as the Lumen Database (https://lumendatabase.org/). address1: Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). @@ -471,13 +481,12 @@ def create( destination IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique - email: A valid email of the abuse reporter. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - - email2: Should match the value provided in `email` + host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. - name: Text not exceeding 255 characters. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). + justification: A detailed description of the infringement, including any necessary access + details and the exact steps needed to view the content, not exceeding 5000 + characters ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. @@ -487,11 +496,18 @@ def create( original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). + owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual port/protocol should not exceed 100 characters. The list should not have more than 30 unique ports and protocols. + reported_country: Text containing 2 characters + + reported_user_agent: Text not exceeding 255 characters + signature: Required for DMCA reports, should be same as Name. An affirmation that all information in the report is true and accurate while agreeing to the policies of Cloudflare's abuse reports @@ -514,11 +530,6 @@ def create( trademark_symbol: Text not exceeding 1000 characters - urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs - should not exceed 250 URLs. All URLs should have the same hostname. Each URL - should be unique. This field may be released by Cloudflare to third parties such - as the Lumen Database (https://lumendatabase.org/). - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -544,9 +555,6 @@ def create( ], *, account_id: str, - host_notification: Literal["send", "send-anon", "none"], - justification: str, - owner_notification: Literal["send", "send-anon", "none"], act: Literal[ "abuse_dmca", "abuse_trademark", @@ -556,8 +564,11 @@ def create( "abuse_threat", "abuse_registrar_whois", "abuse_ncsei", - ] - | NotGiven = NOT_GIVEN, + ], + email: str, + email2: str, + name: str, + urls: str, address1: str | NotGiven = NOT_GIVEN, agent_name: str | NotGiven = NOT_GIVEN, agree: Literal[0, 1] | NotGiven = NOT_GIVEN, @@ -566,13 +577,15 @@ def create( company: str | NotGiven = NOT_GIVEN, country: str | NotGiven = NOT_GIVEN, destination_ips: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - email2: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, + host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, + justification: str | NotGiven = NOT_GIVEN, ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, original_work: str | NotGiven = NOT_GIVEN, + owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ports_protocols: str | NotGiven = NOT_GIVEN, + reported_country: str | NotGiven = NOT_GIVEN, + reported_user_agent: str | NotGiven = NOT_GIVEN, signature: str | NotGiven = NOT_GIVEN, source_ips: str | NotGiven = NOT_GIVEN, state: str | NotGiven = NOT_GIVEN, @@ -581,7 +594,6 @@ def create( trademark_number: str | NotGiven = NOT_GIVEN, trademark_office: str | NotGiven = NOT_GIVEN, trademark_symbol: str | NotGiven = NOT_GIVEN, - urls: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -595,17 +607,20 @@ def create( Args: report_type: The abuse report type - host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + act: The abuse report type - justification: A detailed description of the infringement, including any necessary access - details and the exact steps needed to view the content, not exceeding 5000 - characters + email: A valid email of the abuse reporter. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + email2: Should match the value provided in `email` - act: The abuse report type + name: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). + + urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + should not exceed 250 URLs. All URLs should have the same hostname. Each URL + should be unique. This field may be released by Cloudflare to third parties such + as the Lumen Database (https://lumendatabase.org/). address1: Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). @@ -631,13 +646,12 @@ def create( destination IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique - email: A valid email of the abuse reporter. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - - email2: Should match the value provided in `email` + host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. - name: Text not exceeding 255 characters. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). + justification: A detailed description of the infringement, including any necessary access + details and the exact steps needed to view the content, not exceeding 5000 + characters ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. @@ -647,11 +661,18 @@ def create( original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). + owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual port/protocol should not exceed 100 characters. The list should not have more than 30 unique ports and protocols. + reported_country: Text containing 2 characters + + reported_user_agent: Text not exceeding 255 characters + signature: Required for DMCA reports, should be same as Name. An affirmation that all information in the report is true and accurate while agreeing to the policies of Cloudflare's abuse reports @@ -674,11 +695,6 @@ def create( trademark_symbol: Text not exceeding 1000 characters - urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs - should not exceed 250 URLs. All URLs should have the same hostname. Each URL - should be unique. This field may be released by Cloudflare to third parties such - as the Lumen Database (https://lumendatabase.org/). - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -704,10 +720,6 @@ def create( ], *, account_id: str, - host_notification: Literal["send", "send-anon", "none"], - justification: str, - ncmec_notification: Literal["send", "send-anon", "none"], - owner_notification: Literal["send", "send-anon", "none"], act: Literal[ "abuse_dmca", "abuse_trademark", @@ -717,8 +729,11 @@ def create( "abuse_threat", "abuse_registrar_whois", "abuse_ncsei", - ] - | NotGiven = NOT_GIVEN, + ], + email: str, + email2: str, + name: str, + urls: str, address1: str | NotGiven = NOT_GIVEN, agent_name: str | NotGiven = NOT_GIVEN, agree: Literal[0, 1] | NotGiven = NOT_GIVEN, @@ -727,12 +742,15 @@ def create( company: str | NotGiven = NOT_GIVEN, country: str | NotGiven = NOT_GIVEN, destination_ips: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - email2: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, + host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, + justification: str | NotGiven = NOT_GIVEN, + ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, original_work: str | NotGiven = NOT_GIVEN, + owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ports_protocols: str | NotGiven = NOT_GIVEN, + reported_country: str | NotGiven = NOT_GIVEN, + reported_user_agent: str | NotGiven = NOT_GIVEN, signature: str | NotGiven = NOT_GIVEN, source_ips: str | NotGiven = NOT_GIVEN, state: str | NotGiven = NOT_GIVEN, @@ -741,7 +759,6 @@ def create( trademark_number: str | NotGiven = NOT_GIVEN, trademark_office: str | NotGiven = NOT_GIVEN, trademark_symbol: str | NotGiven = NOT_GIVEN, - urls: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -755,20 +772,20 @@ def create( Args: report_type: The abuse report type - host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + act: The abuse report type - justification: A detailed description of the infringement, including any necessary access - details and the exact steps needed to view the content, not exceeding 5000 - characters + email: A valid email of the abuse reporter. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + email2: Should match the value provided in `email` - owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + name: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - act: The abuse report type + urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + should not exceed 250 URLs. All URLs should have the same hostname. Each URL + should be unique. This field may be released by Cloudflare to third parties such + as the Lumen Database (https://lumendatabase.org/). address1: Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). @@ -794,24 +811,33 @@ def create( destination IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique - email: A valid email of the abuse reporter. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). + host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. - email2: Should match the value provided in `email` + justification: A detailed description of the infringement, including any necessary access + details and the exact steps needed to view the content, not exceeding 5000 + characters - name: Text not exceeding 255 characters. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). + ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report. original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). - ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total + owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + + ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual port/protocol should not exceed 100 characters. The list should not have more than 30 unique ports and protocols. + reported_country: Text containing 2 characters + + reported_user_agent: Text not exceeding 255 characters + signature: Required for DMCA reports, should be same as Name. An affirmation that all information in the report is true and accurate while agreeing to the policies of Cloudflare's abuse reports @@ -834,11 +860,6 @@ def create( trademark_symbol: Text not exceeding 1000 characters - urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs - should not exceed 250 URLs. All URLs should have the same hostname. Each URL - should be unique. This field may be released by Cloudflare to third parties such - as the Lumen Database (https://lumendatabase.org/). - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -864,9 +885,6 @@ def create( ], *, account_id: str, - host_notification: Literal["send", "send-anon", "none"], - justification: str, - owner_notification: Literal["send", "send-anon", "none"], act: Literal[ "abuse_dmca", "abuse_trademark", @@ -876,8 +894,11 @@ def create( "abuse_threat", "abuse_registrar_whois", "abuse_ncsei", - ] - | NotGiven = NOT_GIVEN, + ], + email: str, + email2: str, + name: str, + urls: str, address1: str | NotGiven = NOT_GIVEN, agent_name: str | NotGiven = NOT_GIVEN, agree: Literal[0, 1] | NotGiven = NOT_GIVEN, @@ -886,13 +907,15 @@ def create( company: str | NotGiven = NOT_GIVEN, country: str | NotGiven = NOT_GIVEN, destination_ips: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - email2: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, + host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, + justification: str | NotGiven = NOT_GIVEN, ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, original_work: str | NotGiven = NOT_GIVEN, + owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ports_protocols: str | NotGiven = NOT_GIVEN, + reported_country: str | NotGiven = NOT_GIVEN, + reported_user_agent: str | NotGiven = NOT_GIVEN, signature: str | NotGiven = NOT_GIVEN, source_ips: str | NotGiven = NOT_GIVEN, state: str | NotGiven = NOT_GIVEN, @@ -901,7 +924,6 @@ def create( trademark_number: str | NotGiven = NOT_GIVEN, trademark_office: str | NotGiven = NOT_GIVEN, trademark_symbol: str | NotGiven = NOT_GIVEN, - urls: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -915,17 +937,20 @@ def create( Args: report_type: The abuse report type - host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + act: The abuse report type - justification: A detailed description of the infringement, including any necessary access - details and the exact steps needed to view the content, not exceeding 5000 - characters + email: A valid email of the abuse reporter. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + email2: Should match the value provided in `email` - act: The abuse report type + name: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). + + urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + should not exceed 250 URLs. All URLs should have the same hostname. Each URL + should be unique. This field may be released by Cloudflare to third parties such + as the Lumen Database (https://lumendatabase.org/). address1: Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). @@ -951,13 +976,12 @@ def create( destination IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique - email: A valid email of the abuse reporter. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - - email2: Should match the value provided in `email` + host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. - name: Text not exceeding 255 characters. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). + justification: A detailed description of the infringement, including any necessary access + details and the exact steps needed to view the content, not exceeding 5000 + characters ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. @@ -967,11 +991,18 @@ def create( original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). + owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual port/protocol should not exceed 100 characters. The list should not have more than 30 unique ports and protocols. + reported_country: Text containing 2 characters + + reported_user_agent: Text not exceeding 255 characters + signature: Required for DMCA reports, should be same as Name. An affirmation that all information in the report is true and accurate while agreeing to the policies of Cloudflare's abuse reports @@ -994,11 +1025,6 @@ def create( trademark_symbol: Text not exceeding 1000 characters - urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs - should not exceed 250 URLs. All URLs should have the same hostname. Each URL - should be unique. This field may be released by Cloudflare to third parties such - as the Lumen Database (https://lumendatabase.org/). - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1024,7 +1050,6 @@ def create( ], *, account_id: str, - owner_notification: Literal["send", "send-anon", "none"], act: Literal[ "abuse_dmca", "abuse_trademark", @@ -1034,8 +1059,11 @@ def create( "abuse_threat", "abuse_registrar_whois", "abuse_ncsei", - ] - | NotGiven = NOT_GIVEN, + ], + email: str, + email2: str, + name: str, + urls: str, address1: str | NotGiven = NOT_GIVEN, agent_name: str | NotGiven = NOT_GIVEN, agree: Literal[0, 1] | NotGiven = NOT_GIVEN, @@ -1044,15 +1072,15 @@ def create( company: str | NotGiven = NOT_GIVEN, country: str | NotGiven = NOT_GIVEN, destination_ips: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - email2: str | NotGiven = NOT_GIVEN, host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, justification: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, original_work: str | NotGiven = NOT_GIVEN, + owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ports_protocols: str | NotGiven = NOT_GIVEN, + reported_country: str | NotGiven = NOT_GIVEN, + reported_user_agent: str | NotGiven = NOT_GIVEN, signature: str | NotGiven = NOT_GIVEN, source_ips: str | NotGiven = NOT_GIVEN, state: str | NotGiven = NOT_GIVEN, @@ -1061,7 +1089,6 @@ def create( trademark_number: str | NotGiven = NOT_GIVEN, trademark_office: str | NotGiven = NOT_GIVEN, trademark_symbol: str | NotGiven = NOT_GIVEN, - urls: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1075,11 +1102,21 @@ def create( Args: report_type: The abuse report type - owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. - act: The abuse report type + email: A valid email of the abuse reporter. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). + + email2: Should match the value provided in `email` + + name: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). + + urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + should not exceed 250 URLs. All URLs should have the same hostname. Each URL + should be unique. This field may be released by Cloudflare to third parties such + as the Lumen Database (https://lumendatabase.org/). + address1: Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). @@ -1104,11 +1141,6 @@ def create( destination IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique - email: A valid email of the abuse reporter. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - - email2: Should match the value provided in `email` - host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. @@ -1116,9 +1148,6 @@ def create( details and the exact steps needed to view the content, not exceeding 5000 characters - name: Text not exceeding 255 characters. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. @@ -1127,11 +1156,18 @@ def create( original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). + owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual port/protocol should not exceed 100 characters. The list should not have more than 30 unique ports and protocols. + reported_country: Text containing 2 characters + + reported_user_agent: Text not exceeding 255 characters + signature: Required for DMCA reports, should be same as Name. An affirmation that all information in the report is true and accurate while agreeing to the policies of Cloudflare's abuse reports @@ -1154,11 +1190,6 @@ def create( trademark_symbol: Text not exceeding 1000 characters - urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs - should not exceed 250 URLs. All URLs should have the same hostname. Each URL - should be unique. This field may be released by Cloudflare to third parties such - as the Lumen Database (https://lumendatabase.org/). - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1184,9 +1215,6 @@ def create( ], *, account_id: str, - host_notification: Literal["send", "send-anon", "none"], - ncsei_subject_representation: bool, - owner_notification: Literal["send", "send-anon", "none"], act: Literal[ "abuse_dmca", "abuse_trademark", @@ -1196,8 +1224,11 @@ def create( "abuse_threat", "abuse_registrar_whois", "abuse_ncsei", - ] - | NotGiven = NOT_GIVEN, + ], + email: str, + email2: str, + name: str, + urls: str, address1: str | NotGiven = NOT_GIVEN, agent_name: str | NotGiven = NOT_GIVEN, agree: Literal[0, 1] | NotGiven = NOT_GIVEN, @@ -1206,13 +1237,15 @@ def create( company: str | NotGiven = NOT_GIVEN, country: str | NotGiven = NOT_GIVEN, destination_ips: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - email2: str | NotGiven = NOT_GIVEN, + host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, justification: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, + ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, original_work: str | NotGiven = NOT_GIVEN, + owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ports_protocols: str | NotGiven = NOT_GIVEN, + reported_country: str | NotGiven = NOT_GIVEN, + reported_user_agent: str | NotGiven = NOT_GIVEN, signature: str | NotGiven = NOT_GIVEN, source_ips: str | NotGiven = NOT_GIVEN, state: str | NotGiven = NOT_GIVEN, @@ -1221,7 +1254,6 @@ def create( trademark_number: str | NotGiven = NOT_GIVEN, trademark_office: str | NotGiven = NOT_GIVEN, trademark_symbol: str | NotGiven = NOT_GIVEN, - urls: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1235,15 +1267,20 @@ def create( Args: report_type: The abuse report type - host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + act: The abuse report type - ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report. + email: A valid email of the abuse reporter. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + email2: Should match the value provided in `email` - act: The abuse report type + name: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). + + urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + should not exceed 250 URLs. All URLs should have the same hostname. Each URL + should be unique. This field may be released by Cloudflare to third parties such + as the Lumen Database (https://lumendatabase.org/). address1: Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). @@ -1269,29 +1306,33 @@ def create( destination IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique - email: A valid email of the abuse reporter. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - - email2: Should match the value provided in `email` + host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. justification: A detailed description of the infringement, including any necessary access details and the exact steps needed to view the content, not exceeding 5000 characters - name: Text not exceeding 255 characters. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. + ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report. + original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). + owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual port/protocol should not exceed 100 characters. The list should not have more than 30 unique ports and protocols. + reported_country: Text containing 2 characters + + reported_user_agent: Text not exceeding 255 characters + signature: Required for DMCA reports, should be same as Name. An affirmation that all information in the report is true and accurate while agreeing to the policies of Cloudflare's abuse reports @@ -1314,11 +1355,6 @@ def create( trademark_symbol: Text not exceeding 1000 characters - urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs - should not exceed 250 URLs. All URLs should have the same hostname. Each URL - should be unique. This field may be released by Cloudflare to third parties such - as the Lumen Database (https://lumendatabase.org/). - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1329,34 +1365,7 @@ def create( """ ... - @required_args( - [ - "account_id", - "address1", - "agent_name", - "agree", - "city", - "country", - "host_notification", - "original_work", - "owner_notification", - "signature", - "state", - ], - [ - "account_id", - "host_notification", - "justification", - "owner_notification", - "trademark_number", - "trademark_office", - "trademark_symbol", - ], - ["account_id", "host_notification", "justification", "owner_notification"], - ["account_id", "host_notification", "justification", "ncmec_notification", "owner_notification"], - ["account_id", "owner_notification"], - ["account_id", "host_notification", "ncsei_subject_representation", "owner_notification"], - ) + @required_args(["account_id", "act", "email", "email2", "name", "urls"]) def create( self, report_type: Literal[ @@ -1371,16 +1380,6 @@ def create( ], *, account_id: str, - address1: str | NotGiven = NOT_GIVEN, - agent_name: str | NotGiven = NOT_GIVEN, - agree: Literal[0, 1] | NotGiven = NOT_GIVEN, - city: str | NotGiven = NOT_GIVEN, - country: str | NotGiven = NOT_GIVEN, - host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, - original_work: str | NotGiven = NOT_GIVEN, - owner_notification: Literal["send", "send-anon", "none"], - signature: str | NotGiven = NOT_GIVEN, - state: str | NotGiven = NOT_GIVEN, act: Literal[ "abuse_dmca", "abuse_trademark", @@ -1390,25 +1389,36 @@ def create( "abuse_threat", "abuse_registrar_whois", "abuse_ncsei", - ] - | NotGiven = NOT_GIVEN, + ], + email: str, + email2: str, + name: str, + urls: str, + address1: str | NotGiven = NOT_GIVEN, + agent_name: str | NotGiven = NOT_GIVEN, + agree: Literal[0, 1] | NotGiven = NOT_GIVEN, + city: str | NotGiven = NOT_GIVEN, comments: str | NotGiven = NOT_GIVEN, company: str | NotGiven = NOT_GIVEN, + country: str | NotGiven = NOT_GIVEN, destination_ips: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - email2: str | NotGiven = NOT_GIVEN, + host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, justification: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, + original_work: str | NotGiven = NOT_GIVEN, + owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ports_protocols: str | NotGiven = NOT_GIVEN, + reported_country: str | NotGiven = NOT_GIVEN, + reported_user_agent: str | NotGiven = NOT_GIVEN, + signature: str | NotGiven = NOT_GIVEN, source_ips: str | NotGiven = NOT_GIVEN, + state: str | NotGiven = NOT_GIVEN, tele: str | NotGiven = NOT_GIVEN, title: str | NotGiven = NOT_GIVEN, trademark_number: str | NotGiven = NOT_GIVEN, trademark_office: str | NotGiven = NOT_GIVEN, trademark_symbol: str | NotGiven = NOT_GIVEN, - urls: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1424,34 +1434,36 @@ def create( f"/accounts/{account_id}/abuse-reports/{report_type}", body=maybe_transform( { + "act": act, + "email": email, + "email2": email2, + "name": name, + "urls": urls, "address1": address1, "agent_name": agent_name, "agree": agree, "city": city, - "country": country, - "host_notification": host_notification, - "original_work": original_work, - "owner_notification": owner_notification, - "signature": signature, - "state": state, - "act": act, "comments": comments, "company": company, + "country": country, "destination_ips": destination_ips, - "email": email, - "email2": email2, + "host_notification": host_notification, "justification": justification, - "name": name, "ncmec_notification": ncmec_notification, "ncsei_subject_representation": ncsei_subject_representation, + "original_work": original_work, + "owner_notification": owner_notification, "ports_protocols": ports_protocols, + "reported_country": reported_country, + "reported_user_agent": reported_user_agent, + "signature": signature, "source_ips": source_ips, + "state": state, "tele": tele, "title": title, "trademark_number": trademark_number, "trademark_office": trademark_office, "trademark_symbol": trademark_symbol, - "urls": urls, }, abuse_report_create_params.AbuseReportCreateParams, ), @@ -1501,16 +1513,6 @@ async def create( ], *, account_id: str, - address1: str, - agent_name: str, - agree: Literal[0, 1], - city: str, - country: str, - host_notification: Literal["send", "send-anon", "none"], - original_work: str, - owner_notification: Literal["send", "send-anon", "none"], - signature: str, - state: str, act: Literal[ "abuse_dmca", "abuse_trademark", @@ -1520,25 +1522,36 @@ async def create( "abuse_threat", "abuse_registrar_whois", "abuse_ncsei", - ] - | NotGiven = NOT_GIVEN, + ], + email: str, + email2: str, + name: str, + urls: str, + address1: str | NotGiven = NOT_GIVEN, + agent_name: str | NotGiven = NOT_GIVEN, + agree: Literal[0, 1] | NotGiven = NOT_GIVEN, + city: str | NotGiven = NOT_GIVEN, comments: str | NotGiven = NOT_GIVEN, company: str | NotGiven = NOT_GIVEN, + country: str | NotGiven = NOT_GIVEN, destination_ips: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - email2: str | NotGiven = NOT_GIVEN, + host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, justification: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, + original_work: str | NotGiven = NOT_GIVEN, + owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ports_protocols: str | NotGiven = NOT_GIVEN, + reported_country: str | NotGiven = NOT_GIVEN, + reported_user_agent: str | NotGiven = NOT_GIVEN, + signature: str | NotGiven = NOT_GIVEN, source_ips: str | NotGiven = NOT_GIVEN, + state: str | NotGiven = NOT_GIVEN, tele: str | NotGiven = NOT_GIVEN, title: str | NotGiven = NOT_GIVEN, trademark_number: str | NotGiven = NOT_GIVEN, trademark_office: str | NotGiven = NOT_GIVEN, trademark_symbol: str | NotGiven = NOT_GIVEN, - urls: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1552,74 +1565,83 @@ async def create( Args: report_type: The abuse report type - address1: Text not exceeding 100 characters. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - - agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field - may be released by Cloudflare to third parties such as the Lumen Database - (https://lumendatabase.org/). - - agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports + act: The abuse report type - city: Text not exceeding 255 characters. This field may be released by Cloudflare to + email: A valid email of the abuse reporter. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). - country: Text not exceeding 255 characters. This field may be released by Cloudflare to + email2: Should match the value provided in `email` + + name: Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). - host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + should not exceed 250 URLs. All URLs should have the same hostname. Each URL + should be unique. This field may be released by Cloudflare to third parties such + as the Lumen Database (https://lumendatabase.org/). - original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to + address1: Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). - owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field + may be released by Cloudflare to third parties such as the Lumen Database + (https://lumendatabase.org/). - signature: Required for DMCA reports, should be same as Name. An affirmation that all - information in the report is true and accurate while agreeing to the policies of - Cloudflare's abuse reports + agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports - state: Text not exceeding 255 characters. This field may be released by Cloudflare to + city: Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). - act: The abuse report type - comments: Any additional comments about the infringement not exceeding 2000 characters company: Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). + country: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). + destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of destination IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique - email: A valid email of the abuse reporter. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - - email2: Should match the value provided in `email` + host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. justification: A detailed description of the infringement, including any necessary access details and the exact steps needed to view the content, not exceeding 5000 characters - name: Text not exceeding 255 characters. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report. + original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). + + owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual port/protocol should not exceed 100 characters. The list should not have more than 30 unique ports and protocols. + reported_country: Text containing 2 characters + + reported_user_agent: Text not exceeding 255 characters + + signature: Required for DMCA reports, should be same as Name. An affirmation that all + information in the report is true and accurate while agreeing to the policies of + Cloudflare's abuse reports + source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique + state: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). + tele: Text not exceeding 20 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). @@ -1631,11 +1653,6 @@ async def create( trademark_symbol: Text not exceeding 1000 characters - urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs - should not exceed 250 URLs. All URLs should have the same hostname. Each URL - should be unique. This field may be released by Cloudflare to third parties such - as the Lumen Database (https://lumendatabase.org/). - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1661,12 +1678,6 @@ async def create( ], *, account_id: str, - host_notification: Literal["send", "send-anon", "none"], - justification: str, - owner_notification: Literal["send", "send-anon", "none"], - trademark_number: str, - trademark_office: str, - trademark_symbol: str, act: Literal[ "abuse_dmca", "abuse_trademark", @@ -1676,8 +1687,11 @@ async def create( "abuse_threat", "abuse_registrar_whois", "abuse_ncsei", - ] - | NotGiven = NOT_GIVEN, + ], + email: str, + email2: str, + name: str, + urls: str, address1: str | NotGiven = NOT_GIVEN, agent_name: str | NotGiven = NOT_GIVEN, agree: Literal[0, 1] | NotGiven = NOT_GIVEN, @@ -1686,19 +1700,23 @@ async def create( company: str | NotGiven = NOT_GIVEN, country: str | NotGiven = NOT_GIVEN, destination_ips: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - email2: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, + host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, + justification: str | NotGiven = NOT_GIVEN, ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, original_work: str | NotGiven = NOT_GIVEN, + owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ports_protocols: str | NotGiven = NOT_GIVEN, + reported_country: str | NotGiven = NOT_GIVEN, + reported_user_agent: str | NotGiven = NOT_GIVEN, signature: str | NotGiven = NOT_GIVEN, source_ips: str | NotGiven = NOT_GIVEN, state: str | NotGiven = NOT_GIVEN, tele: str | NotGiven = NOT_GIVEN, title: str | NotGiven = NOT_GIVEN, - urls: str | NotGiven = NOT_GIVEN, + trademark_number: str | NotGiven = NOT_GIVEN, + trademark_office: str | NotGiven = NOT_GIVEN, + trademark_symbol: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1712,23 +1730,20 @@ async def create( Args: report_type: The abuse report type - host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. - - justification: A detailed description of the infringement, including any necessary access - details and the exact steps needed to view the content, not exceeding 5000 - characters - - owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + act: The abuse report type - trademark_number: Text not exceeding 1000 characters + email: A valid email of the abuse reporter. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - trademark_office: Text not exceeding 1000 characters + email2: Should match the value provided in `email` - trademark_symbol: Text not exceeding 1000 characters + name: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - act: The abuse report type + urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + should not exceed 250 URLs. All URLs should have the same hostname. Each URL + should be unique. This field may be released by Cloudflare to third parties such + as the Lumen Database (https://lumendatabase.org/). address1: Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). @@ -1754,13 +1769,12 @@ async def create( destination IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique - email: A valid email of the abuse reporter. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - - email2: Should match the value provided in `email` + host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. - name: Text not exceeding 255 characters. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). + justification: A detailed description of the infringement, including any necessary access + details and the exact steps needed to view the content, not exceeding 5000 + characters ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. @@ -1770,11 +1784,18 @@ async def create( original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). + owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual port/protocol should not exceed 100 characters. The list should not have more than 30 unique ports and protocols. + reported_country: Text containing 2 characters + + reported_user_agent: Text not exceeding 255 characters + signature: Required for DMCA reports, should be same as Name. An affirmation that all information in the report is true and accurate while agreeing to the policies of Cloudflare's abuse reports @@ -1791,10 +1812,11 @@ async def create( title: Text not exceeding 255 characters - urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs - should not exceed 250 URLs. All URLs should have the same hostname. Each URL - should be unique. This field may be released by Cloudflare to third parties such - as the Lumen Database (https://lumendatabase.org/). + trademark_number: Text not exceeding 1000 characters + + trademark_office: Text not exceeding 1000 characters + + trademark_symbol: Text not exceeding 1000 characters extra_headers: Send extra headers @@ -1821,9 +1843,6 @@ async def create( ], *, account_id: str, - host_notification: Literal["send", "send-anon", "none"], - justification: str, - owner_notification: Literal["send", "send-anon", "none"], act: Literal[ "abuse_dmca", "abuse_trademark", @@ -1833,8 +1852,11 @@ async def create( "abuse_threat", "abuse_registrar_whois", "abuse_ncsei", - ] - | NotGiven = NOT_GIVEN, + ], + email: str, + email2: str, + name: str, + urls: str, address1: str | NotGiven = NOT_GIVEN, agent_name: str | NotGiven = NOT_GIVEN, agree: Literal[0, 1] | NotGiven = NOT_GIVEN, @@ -1843,13 +1865,15 @@ async def create( company: str | NotGiven = NOT_GIVEN, country: str | NotGiven = NOT_GIVEN, destination_ips: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - email2: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, + host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, + justification: str | NotGiven = NOT_GIVEN, ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, original_work: str | NotGiven = NOT_GIVEN, + owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ports_protocols: str | NotGiven = NOT_GIVEN, + reported_country: str | NotGiven = NOT_GIVEN, + reported_user_agent: str | NotGiven = NOT_GIVEN, signature: str | NotGiven = NOT_GIVEN, source_ips: str | NotGiven = NOT_GIVEN, state: str | NotGiven = NOT_GIVEN, @@ -1858,7 +1882,6 @@ async def create( trademark_number: str | NotGiven = NOT_GIVEN, trademark_office: str | NotGiven = NOT_GIVEN, trademark_symbol: str | NotGiven = NOT_GIVEN, - urls: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1872,17 +1895,20 @@ async def create( Args: report_type: The abuse report type - host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + act: The abuse report type - justification: A detailed description of the infringement, including any necessary access - details and the exact steps needed to view the content, not exceeding 5000 - characters + email: A valid email of the abuse reporter. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + email2: Should match the value provided in `email` - act: The abuse report type + name: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). + + urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + should not exceed 250 URLs. All URLs should have the same hostname. Each URL + should be unique. This field may be released by Cloudflare to third parties such + as the Lumen Database (https://lumendatabase.org/). address1: Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). @@ -1908,13 +1934,12 @@ async def create( destination IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique - email: A valid email of the abuse reporter. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - - email2: Should match the value provided in `email` + host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. - name: Text not exceeding 255 characters. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). + justification: A detailed description of the infringement, including any necessary access + details and the exact steps needed to view the content, not exceeding 5000 + characters ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. @@ -1924,11 +1949,18 @@ async def create( original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). + owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual port/protocol should not exceed 100 characters. The list should not have more than 30 unique ports and protocols. + reported_country: Text containing 2 characters + + reported_user_agent: Text not exceeding 255 characters + signature: Required for DMCA reports, should be same as Name. An affirmation that all information in the report is true and accurate while agreeing to the policies of Cloudflare's abuse reports @@ -1951,11 +1983,6 @@ async def create( trademark_symbol: Text not exceeding 1000 characters - urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs - should not exceed 250 URLs. All URLs should have the same hostname. Each URL - should be unique. This field may be released by Cloudflare to third parties such - as the Lumen Database (https://lumendatabase.org/). - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1981,9 +2008,6 @@ async def create( ], *, account_id: str, - host_notification: Literal["send", "send-anon", "none"], - justification: str, - owner_notification: Literal["send", "send-anon", "none"], act: Literal[ "abuse_dmca", "abuse_trademark", @@ -1993,8 +2017,11 @@ async def create( "abuse_threat", "abuse_registrar_whois", "abuse_ncsei", - ] - | NotGiven = NOT_GIVEN, + ], + email: str, + email2: str, + name: str, + urls: str, address1: str | NotGiven = NOT_GIVEN, agent_name: str | NotGiven = NOT_GIVEN, agree: Literal[0, 1] | NotGiven = NOT_GIVEN, @@ -2003,13 +2030,15 @@ async def create( company: str | NotGiven = NOT_GIVEN, country: str | NotGiven = NOT_GIVEN, destination_ips: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - email2: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, + host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, + justification: str | NotGiven = NOT_GIVEN, ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, original_work: str | NotGiven = NOT_GIVEN, + owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ports_protocols: str | NotGiven = NOT_GIVEN, + reported_country: str | NotGiven = NOT_GIVEN, + reported_user_agent: str | NotGiven = NOT_GIVEN, signature: str | NotGiven = NOT_GIVEN, source_ips: str | NotGiven = NOT_GIVEN, state: str | NotGiven = NOT_GIVEN, @@ -2018,7 +2047,6 @@ async def create( trademark_number: str | NotGiven = NOT_GIVEN, trademark_office: str | NotGiven = NOT_GIVEN, trademark_symbol: str | NotGiven = NOT_GIVEN, - urls: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -2032,17 +2060,20 @@ async def create( Args: report_type: The abuse report type - host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + act: The abuse report type - justification: A detailed description of the infringement, including any necessary access - details and the exact steps needed to view the content, not exceeding 5000 - characters + email: A valid email of the abuse reporter. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + email2: Should match the value provided in `email` - act: The abuse report type + name: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). + + urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + should not exceed 250 URLs. All URLs should have the same hostname. Each URL + should be unique. This field may be released by Cloudflare to third parties such + as the Lumen Database (https://lumendatabase.org/). address1: Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). @@ -2068,13 +2099,12 @@ async def create( destination IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique - email: A valid email of the abuse reporter. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - - email2: Should match the value provided in `email` + host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. - name: Text not exceeding 255 characters. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). + justification: A detailed description of the infringement, including any necessary access + details and the exact steps needed to view the content, not exceeding 5000 + characters ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. @@ -2084,11 +2114,18 @@ async def create( original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). + owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual port/protocol should not exceed 100 characters. The list should not have more than 30 unique ports and protocols. + reported_country: Text containing 2 characters + + reported_user_agent: Text not exceeding 255 characters + signature: Required for DMCA reports, should be same as Name. An affirmation that all information in the report is true and accurate while agreeing to the policies of Cloudflare's abuse reports @@ -2111,11 +2148,6 @@ async def create( trademark_symbol: Text not exceeding 1000 characters - urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs - should not exceed 250 URLs. All URLs should have the same hostname. Each URL - should be unique. This field may be released by Cloudflare to third parties such - as the Lumen Database (https://lumendatabase.org/). - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -2141,10 +2173,6 @@ async def create( ], *, account_id: str, - host_notification: Literal["send", "send-anon", "none"], - justification: str, - ncmec_notification: Literal["send", "send-anon", "none"], - owner_notification: Literal["send", "send-anon", "none"], act: Literal[ "abuse_dmca", "abuse_trademark", @@ -2154,8 +2182,11 @@ async def create( "abuse_threat", "abuse_registrar_whois", "abuse_ncsei", - ] - | NotGiven = NOT_GIVEN, + ], + email: str, + email2: str, + name: str, + urls: str, address1: str | NotGiven = NOT_GIVEN, agent_name: str | NotGiven = NOT_GIVEN, agree: Literal[0, 1] | NotGiven = NOT_GIVEN, @@ -2164,12 +2195,15 @@ async def create( company: str | NotGiven = NOT_GIVEN, country: str | NotGiven = NOT_GIVEN, destination_ips: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - email2: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, + host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, + justification: str | NotGiven = NOT_GIVEN, + ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, original_work: str | NotGiven = NOT_GIVEN, + owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ports_protocols: str | NotGiven = NOT_GIVEN, + reported_country: str | NotGiven = NOT_GIVEN, + reported_user_agent: str | NotGiven = NOT_GIVEN, signature: str | NotGiven = NOT_GIVEN, source_ips: str | NotGiven = NOT_GIVEN, state: str | NotGiven = NOT_GIVEN, @@ -2178,7 +2212,6 @@ async def create( trademark_number: str | NotGiven = NOT_GIVEN, trademark_office: str | NotGiven = NOT_GIVEN, trademark_symbol: str | NotGiven = NOT_GIVEN, - urls: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -2192,20 +2225,20 @@ async def create( Args: report_type: The abuse report type - host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + act: The abuse report type - justification: A detailed description of the infringement, including any necessary access - details and the exact steps needed to view the content, not exceeding 5000 - characters + email: A valid email of the abuse reporter. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + email2: Should match the value provided in `email` - owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + name: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - act: The abuse report type + urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + should not exceed 250 URLs. All URLs should have the same hostname. Each URL + should be unique. This field may be released by Cloudflare to third parties such + as the Lumen Database (https://lumendatabase.org/). address1: Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). @@ -2231,24 +2264,33 @@ async def create( destination IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique - email: A valid email of the abuse reporter. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). + host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. - email2: Should match the value provided in `email` + justification: A detailed description of the infringement, including any necessary access + details and the exact steps needed to view the content, not exceeding 5000 + characters - name: Text not exceeding 255 characters. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). + ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report. original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). + owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual port/protocol should not exceed 100 characters. The list should not have more than 30 unique ports and protocols. + reported_country: Text containing 2 characters + + reported_user_agent: Text not exceeding 255 characters + signature: Required for DMCA reports, should be same as Name. An affirmation that all information in the report is true and accurate while agreeing to the policies of Cloudflare's abuse reports @@ -2271,11 +2313,6 @@ async def create( trademark_symbol: Text not exceeding 1000 characters - urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs - should not exceed 250 URLs. All URLs should have the same hostname. Each URL - should be unique. This field may be released by Cloudflare to third parties such - as the Lumen Database (https://lumendatabase.org/). - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -2301,9 +2338,6 @@ async def create( ], *, account_id: str, - host_notification: Literal["send", "send-anon", "none"], - justification: str, - owner_notification: Literal["send", "send-anon", "none"], act: Literal[ "abuse_dmca", "abuse_trademark", @@ -2313,8 +2347,11 @@ async def create( "abuse_threat", "abuse_registrar_whois", "abuse_ncsei", - ] - | NotGiven = NOT_GIVEN, + ], + email: str, + email2: str, + name: str, + urls: str, address1: str | NotGiven = NOT_GIVEN, agent_name: str | NotGiven = NOT_GIVEN, agree: Literal[0, 1] | NotGiven = NOT_GIVEN, @@ -2323,13 +2360,15 @@ async def create( company: str | NotGiven = NOT_GIVEN, country: str | NotGiven = NOT_GIVEN, destination_ips: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - email2: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, + host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, + justification: str | NotGiven = NOT_GIVEN, ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, original_work: str | NotGiven = NOT_GIVEN, + owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ports_protocols: str | NotGiven = NOT_GIVEN, + reported_country: str | NotGiven = NOT_GIVEN, + reported_user_agent: str | NotGiven = NOT_GIVEN, signature: str | NotGiven = NOT_GIVEN, source_ips: str | NotGiven = NOT_GIVEN, state: str | NotGiven = NOT_GIVEN, @@ -2338,7 +2377,6 @@ async def create( trademark_number: str | NotGiven = NOT_GIVEN, trademark_office: str | NotGiven = NOT_GIVEN, trademark_symbol: str | NotGiven = NOT_GIVEN, - urls: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -2352,17 +2390,20 @@ async def create( Args: report_type: The abuse report type - host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + act: The abuse report type - justification: A detailed description of the infringement, including any necessary access - details and the exact steps needed to view the content, not exceeding 5000 - characters + email: A valid email of the abuse reporter. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + email2: Should match the value provided in `email` - act: The abuse report type + name: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). + + urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + should not exceed 250 URLs. All URLs should have the same hostname. Each URL + should be unique. This field may be released by Cloudflare to third parties such + as the Lumen Database (https://lumendatabase.org/). address1: Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). @@ -2388,13 +2429,12 @@ async def create( destination IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique - email: A valid email of the abuse reporter. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - - email2: Should match the value provided in `email` + host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. - name: Text not exceeding 255 characters. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). + justification: A detailed description of the infringement, including any necessary access + details and the exact steps needed to view the content, not exceeding 5000 + characters ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. @@ -2404,11 +2444,18 @@ async def create( original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). + owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual port/protocol should not exceed 100 characters. The list should not have more than 30 unique ports and protocols. + reported_country: Text containing 2 characters + + reported_user_agent: Text not exceeding 255 characters + signature: Required for DMCA reports, should be same as Name. An affirmation that all information in the report is true and accurate while agreeing to the policies of Cloudflare's abuse reports @@ -2431,11 +2478,6 @@ async def create( trademark_symbol: Text not exceeding 1000 characters - urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs - should not exceed 250 URLs. All URLs should have the same hostname. Each URL - should be unique. This field may be released by Cloudflare to third parties such - as the Lumen Database (https://lumendatabase.org/). - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -2461,7 +2503,6 @@ async def create( ], *, account_id: str, - owner_notification: Literal["send", "send-anon", "none"], act: Literal[ "abuse_dmca", "abuse_trademark", @@ -2471,8 +2512,11 @@ async def create( "abuse_threat", "abuse_registrar_whois", "abuse_ncsei", - ] - | NotGiven = NOT_GIVEN, + ], + email: str, + email2: str, + name: str, + urls: str, address1: str | NotGiven = NOT_GIVEN, agent_name: str | NotGiven = NOT_GIVEN, agree: Literal[0, 1] | NotGiven = NOT_GIVEN, @@ -2481,15 +2525,15 @@ async def create( company: str | NotGiven = NOT_GIVEN, country: str | NotGiven = NOT_GIVEN, destination_ips: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - email2: str | NotGiven = NOT_GIVEN, host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, justification: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, original_work: str | NotGiven = NOT_GIVEN, + owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ports_protocols: str | NotGiven = NOT_GIVEN, + reported_country: str | NotGiven = NOT_GIVEN, + reported_user_agent: str | NotGiven = NOT_GIVEN, signature: str | NotGiven = NOT_GIVEN, source_ips: str | NotGiven = NOT_GIVEN, state: str | NotGiven = NOT_GIVEN, @@ -2498,7 +2542,6 @@ async def create( trademark_number: str | NotGiven = NOT_GIVEN, trademark_office: str | NotGiven = NOT_GIVEN, trademark_symbol: str | NotGiven = NOT_GIVEN, - urls: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -2512,11 +2555,21 @@ async def create( Args: report_type: The abuse report type - owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. - act: The abuse report type + email: A valid email of the abuse reporter. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). + + email2: Should match the value provided in `email` + + name: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). + + urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + should not exceed 250 URLs. All URLs should have the same hostname. Each URL + should be unique. This field may be released by Cloudflare to third parties such + as the Lumen Database (https://lumendatabase.org/). + address1: Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). @@ -2541,11 +2594,6 @@ async def create( destination IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique - email: A valid email of the abuse reporter. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - - email2: Should match the value provided in `email` - host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. @@ -2553,9 +2601,6 @@ async def create( details and the exact steps needed to view the content, not exceeding 5000 characters - name: Text not exceeding 255 characters. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. @@ -2564,11 +2609,18 @@ async def create( original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). + owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual port/protocol should not exceed 100 characters. The list should not have more than 30 unique ports and protocols. + reported_country: Text containing 2 characters + + reported_user_agent: Text not exceeding 255 characters + signature: Required for DMCA reports, should be same as Name. An affirmation that all information in the report is true and accurate while agreeing to the policies of Cloudflare's abuse reports @@ -2591,11 +2643,6 @@ async def create( trademark_symbol: Text not exceeding 1000 characters - urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs - should not exceed 250 URLs. All URLs should have the same hostname. Each URL - should be unique. This field may be released by Cloudflare to third parties such - as the Lumen Database (https://lumendatabase.org/). - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -2621,9 +2668,6 @@ async def create( ], *, account_id: str, - host_notification: Literal["send", "send-anon", "none"], - ncsei_subject_representation: bool, - owner_notification: Literal["send", "send-anon", "none"], act: Literal[ "abuse_dmca", "abuse_trademark", @@ -2633,8 +2677,11 @@ async def create( "abuse_threat", "abuse_registrar_whois", "abuse_ncsei", - ] - | NotGiven = NOT_GIVEN, + ], + email: str, + email2: str, + name: str, + urls: str, address1: str | NotGiven = NOT_GIVEN, agent_name: str | NotGiven = NOT_GIVEN, agree: Literal[0, 1] | NotGiven = NOT_GIVEN, @@ -2643,13 +2690,15 @@ async def create( company: str | NotGiven = NOT_GIVEN, country: str | NotGiven = NOT_GIVEN, destination_ips: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - email2: str | NotGiven = NOT_GIVEN, + host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, justification: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, + ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, original_work: str | NotGiven = NOT_GIVEN, + owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ports_protocols: str | NotGiven = NOT_GIVEN, + reported_country: str | NotGiven = NOT_GIVEN, + reported_user_agent: str | NotGiven = NOT_GIVEN, signature: str | NotGiven = NOT_GIVEN, source_ips: str | NotGiven = NOT_GIVEN, state: str | NotGiven = NOT_GIVEN, @@ -2658,7 +2707,6 @@ async def create( trademark_number: str | NotGiven = NOT_GIVEN, trademark_office: str | NotGiven = NOT_GIVEN, trademark_symbol: str | NotGiven = NOT_GIVEN, - urls: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -2672,15 +2720,20 @@ async def create( Args: report_type: The abuse report type - host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + act: The abuse report type - ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report. + email: A valid email of the abuse reporter. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark - reports cannot be anonymous. + email2: Should match the value provided in `email` - act: The abuse report type + name: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). + + urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs + should not exceed 250 URLs. All URLs should have the same hostname. Each URL + should be unique. This field may be released by Cloudflare to third parties such + as the Lumen Database (https://lumendatabase.org/). address1: Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). @@ -2706,29 +2759,33 @@ async def create( destination IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique - email: A valid email of the abuse reporter. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - - email2: Should match the value provided in `email` + host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. justification: A detailed description of the infringement, including any necessary access details and the exact steps needed to view the content, not exceeding 5000 characters - name: Text not exceeding 255 characters. This field may be released by Cloudflare to - third parties such as the Lumen Database (https://lumendatabase.org/). - ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. + ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report. + original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). + owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark + reports cannot be anonymous. + ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual port/protocol should not exceed 100 characters. The list should not have more than 30 unique ports and protocols. + reported_country: Text containing 2 characters + + reported_user_agent: Text not exceeding 255 characters + signature: Required for DMCA reports, should be same as Name. An affirmation that all information in the report is true and accurate while agreeing to the policies of Cloudflare's abuse reports @@ -2751,11 +2808,6 @@ async def create( trademark_symbol: Text not exceeding 1000 characters - urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs - should not exceed 250 URLs. All URLs should have the same hostname. Each URL - should be unique. This field may be released by Cloudflare to third parties such - as the Lumen Database (https://lumendatabase.org/). - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -2766,34 +2818,7 @@ async def create( """ ... - @required_args( - [ - "account_id", - "address1", - "agent_name", - "agree", - "city", - "country", - "host_notification", - "original_work", - "owner_notification", - "signature", - "state", - ], - [ - "account_id", - "host_notification", - "justification", - "owner_notification", - "trademark_number", - "trademark_office", - "trademark_symbol", - ], - ["account_id", "host_notification", "justification", "owner_notification"], - ["account_id", "host_notification", "justification", "ncmec_notification", "owner_notification"], - ["account_id", "owner_notification"], - ["account_id", "host_notification", "ncsei_subject_representation", "owner_notification"], - ) + @required_args(["account_id", "act", "email", "email2", "name", "urls"]) async def create( self, report_type: Literal[ @@ -2808,16 +2833,6 @@ async def create( ], *, account_id: str, - address1: str | NotGiven = NOT_GIVEN, - agent_name: str | NotGiven = NOT_GIVEN, - agree: Literal[0, 1] | NotGiven = NOT_GIVEN, - city: str | NotGiven = NOT_GIVEN, - country: str | NotGiven = NOT_GIVEN, - host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, - original_work: str | NotGiven = NOT_GIVEN, - owner_notification: Literal["send", "send-anon", "none"], - signature: str | NotGiven = NOT_GIVEN, - state: str | NotGiven = NOT_GIVEN, act: Literal[ "abuse_dmca", "abuse_trademark", @@ -2827,25 +2842,36 @@ async def create( "abuse_threat", "abuse_registrar_whois", "abuse_ncsei", - ] - | NotGiven = NOT_GIVEN, + ], + email: str, + email2: str, + name: str, + urls: str, + address1: str | NotGiven = NOT_GIVEN, + agent_name: str | NotGiven = NOT_GIVEN, + agree: Literal[0, 1] | NotGiven = NOT_GIVEN, + city: str | NotGiven = NOT_GIVEN, comments: str | NotGiven = NOT_GIVEN, company: str | NotGiven = NOT_GIVEN, + country: str | NotGiven = NOT_GIVEN, destination_ips: str | NotGiven = NOT_GIVEN, - email: str | NotGiven = NOT_GIVEN, - email2: str | NotGiven = NOT_GIVEN, + host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, justification: str | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ncsei_subject_representation: bool | NotGiven = NOT_GIVEN, + original_work: str | NotGiven = NOT_GIVEN, + owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN, ports_protocols: str | NotGiven = NOT_GIVEN, + reported_country: str | NotGiven = NOT_GIVEN, + reported_user_agent: str | NotGiven = NOT_GIVEN, + signature: str | NotGiven = NOT_GIVEN, source_ips: str | NotGiven = NOT_GIVEN, + state: str | NotGiven = NOT_GIVEN, tele: str | NotGiven = NOT_GIVEN, title: str | NotGiven = NOT_GIVEN, trademark_number: str | NotGiven = NOT_GIVEN, trademark_office: str | NotGiven = NOT_GIVEN, trademark_symbol: str | NotGiven = NOT_GIVEN, - urls: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -2861,34 +2887,36 @@ async def create( f"/accounts/{account_id}/abuse-reports/{report_type}", body=await async_maybe_transform( { + "act": act, + "email": email, + "email2": email2, + "name": name, + "urls": urls, "address1": address1, "agent_name": agent_name, "agree": agree, "city": city, - "country": country, - "host_notification": host_notification, - "original_work": original_work, - "owner_notification": owner_notification, - "signature": signature, - "state": state, - "act": act, "comments": comments, "company": company, + "country": country, "destination_ips": destination_ips, - "email": email, - "email2": email2, + "host_notification": host_notification, "justification": justification, - "name": name, "ncmec_notification": ncmec_notification, "ncsei_subject_representation": ncsei_subject_representation, + "original_work": original_work, + "owner_notification": owner_notification, "ports_protocols": ports_protocols, + "reported_country": reported_country, + "reported_user_agent": reported_user_agent, + "signature": signature, "source_ips": source_ips, + "state": state, "tele": tele, "title": title, "trademark_number": trademark_number, "trademark_office": trademark_office, "trademark_symbol": trademark_symbol, - "urls": urls, }, abuse_report_create_params.AbuseReportCreateParams, ), diff --git a/src/cloudflare/resources/accounts/accounts.py b/src/cloudflare/resources/accounts/accounts.py index d59d809d688..2ee703b9f22 100644 --- a/src/cloudflare/resources/accounts/accounts.py +++ b/src/cloudflare/resources/accounts/accounts.py @@ -24,10 +24,7 @@ AsyncMembersResourceWithStreamingResponse, ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from .logs.logs import ( LogsResource, diff --git a/src/cloudflare/resources/accounts/members.py b/src/cloudflare/resources/accounts/members.py index 1565d83d173..cf81af9febe 100644 --- a/src/cloudflare/resources/accounts/members.py +++ b/src/cloudflare/resources/accounts/members.py @@ -8,11 +8,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - required_args, - maybe_transform, - async_maybe_transform, -) +from ..._utils import required_args, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( diff --git a/src/cloudflare/resources/accounts/subscriptions.py b/src/cloudflare/resources/accounts/subscriptions.py index 542727c8900..11c77ea9015 100644 --- a/src/cloudflare/resources/accounts/subscriptions.py +++ b/src/cloudflare/resources/accounts/subscriptions.py @@ -8,10 +8,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( diff --git a/src/cloudflare/resources/accounts/tokens/tokens.py b/src/cloudflare/resources/accounts/tokens/tokens.py index 5af8755d84e..4f50160a6df 100644 --- a/src/cloudflare/resources/accounts/tokens/tokens.py +++ b/src/cloudflare/resources/accounts/tokens/tokens.py @@ -17,10 +17,7 @@ AsyncValueResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( diff --git a/src/cloudflare/resources/accounts/tokens/value.py b/src/cloudflare/resources/accounts/tokens/value.py index 94034ab2a7d..21e9ddc0027 100644 --- a/src/cloudflare/resources/accounts/tokens/value.py +++ b/src/cloudflare/resources/accounts/tokens/value.py @@ -7,10 +7,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( diff --git a/src/cloudflare/resources/acm/total_tls.py b/src/cloudflare/resources/acm/total_tls.py index 2d0e550ccf5..b815c0c0370 100644 --- a/src/cloudflare/resources/acm/total_tls.py +++ b/src/cloudflare/resources/acm/total_tls.py @@ -7,10 +7,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -66,7 +63,7 @@ def create( Set Total TLS Settings or disable the feature for a Zone. Args: - zone_id: Identifier + zone_id: Identifier. enabled: If enabled, Total TLS will order a hostname specific TLS certificate for any proxied A, AAAA, or CNAME record in your zone. @@ -117,7 +114,7 @@ def get( Get Total TLS Settings for a Zone. Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers @@ -179,7 +176,7 @@ async def create( Set Total TLS Settings or disable the feature for a Zone. Args: - zone_id: Identifier + zone_id: Identifier. enabled: If enabled, Total TLS will order a hostname specific TLS certificate for any proxied A, AAAA, or CNAME record in your zone. @@ -230,7 +227,7 @@ async def get( Get Total TLS Settings for a Zone. Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers diff --git a/src/cloudflare/resources/addressing/address_maps/accounts.py b/src/cloudflare/resources/addressing/address_maps/accounts.py index d30e053c698..42533eb9fc4 100644 --- a/src/cloudflare/resources/addressing/address_maps/accounts.py +++ b/src/cloudflare/resources/addressing/address_maps/accounts.py @@ -5,10 +5,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( diff --git a/src/cloudflare/resources/addressing/address_maps/address_maps.py b/src/cloudflare/resources/addressing/address_maps/address_maps.py index e2dd8d9111d..51effb2d79f 100644 --- a/src/cloudflare/resources/addressing/address_maps/address_maps.py +++ b/src/cloudflare/resources/addressing/address_maps/address_maps.py @@ -31,10 +31,7 @@ AsyncAccountsResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( diff --git a/src/cloudflare/resources/addressing/address_maps/ips.py b/src/cloudflare/resources/addressing/address_maps/ips.py index c17ae0f81bc..7c2831ec8ba 100644 --- a/src/cloudflare/resources/addressing/address_maps/ips.py +++ b/src/cloudflare/resources/addressing/address_maps/ips.py @@ -5,10 +5,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( diff --git a/src/cloudflare/resources/addressing/address_maps/zones.py b/src/cloudflare/resources/addressing/address_maps/zones.py index b0813f207c3..fb721f75bbf 100644 --- a/src/cloudflare/resources/addressing/address_maps/zones.py +++ b/src/cloudflare/resources/addressing/address_maps/zones.py @@ -5,10 +5,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( diff --git a/src/cloudflare/resources/addressing/loa_documents.py b/src/cloudflare/resources/addressing/loa_documents.py index 47abb0af10f..211478a293c 100644 --- a/src/cloudflare/resources/addressing/loa_documents.py +++ b/src/cloudflare/resources/addressing/loa_documents.py @@ -7,10 +7,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( diff --git a/src/cloudflare/resources/addressing/prefixes/advertisement_status.py b/src/cloudflare/resources/addressing/prefixes/advertisement_status.py index c8ce2f9fb6b..2152615ba1f 100644 --- a/src/cloudflare/resources/addressing/prefixes/advertisement_status.py +++ b/src/cloudflare/resources/addressing/prefixes/advertisement_status.py @@ -7,10 +7,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( diff --git a/src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py b/src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py index f933e12539e..c93b5901764 100644 --- a/src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py +++ b/src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py @@ -7,10 +7,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -149,7 +146,9 @@ def edit( *, account_id: str, prefix_id: str, + asn_prepend_count: int | NotGiven = NOT_GIVEN, on_demand: bgp_prefix_edit_params.OnDemand | NotGiven = NOT_GIVEN, + withdraw_if_no_route: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -168,6 +167,12 @@ def edit( bgp_prefix_id: Identifier of BGP Prefix. + asn_prepend_count: Number of times to prepend the Cloudflare ASN to the BGP AS-Path attribute + + withdraw_if_no_route: Controls whether the BGP prefix is automatically withdrawn when prefix is + withdrawn from Magic routing table (for Magic Transit customers using Direct + CNI) + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -184,7 +189,14 @@ def edit( raise ValueError(f"Expected a non-empty value for `bgp_prefix_id` but received {bgp_prefix_id!r}") return self._patch( f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes/{bgp_prefix_id}", - body=maybe_transform({"on_demand": on_demand}, bgp_prefix_edit_params.BGPPrefixEditParams), + body=maybe_transform( + { + "asn_prepend_count": asn_prepend_count, + "on_demand": on_demand, + "withdraw_if_no_route": withdraw_if_no_route, + }, + bgp_prefix_edit_params.BGPPrefixEditParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -366,7 +378,9 @@ async def edit( *, account_id: str, prefix_id: str, + asn_prepend_count: int | NotGiven = NOT_GIVEN, on_demand: bgp_prefix_edit_params.OnDemand | NotGiven = NOT_GIVEN, + withdraw_if_no_route: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -385,6 +399,12 @@ async def edit( bgp_prefix_id: Identifier of BGP Prefix. + asn_prepend_count: Number of times to prepend the Cloudflare ASN to the BGP AS-Path attribute + + withdraw_if_no_route: Controls whether the BGP prefix is automatically withdrawn when prefix is + withdrawn from Magic routing table (for Magic Transit customers using Direct + CNI) + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -401,7 +421,14 @@ async def edit( raise ValueError(f"Expected a non-empty value for `bgp_prefix_id` but received {bgp_prefix_id!r}") return await self._patch( f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes/{bgp_prefix_id}", - body=await async_maybe_transform({"on_demand": on_demand}, bgp_prefix_edit_params.BGPPrefixEditParams), + body=await async_maybe_transform( + { + "asn_prepend_count": asn_prepend_count, + "on_demand": on_demand, + "withdraw_if_no_route": withdraw_if_no_route, + }, + bgp_prefix_edit_params.BGPPrefixEditParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/addressing/prefixes/delegations.py b/src/cloudflare/resources/addressing/prefixes/delegations.py index 6c1e409eef1..d71656994f4 100644 --- a/src/cloudflare/resources/addressing/prefixes/delegations.py +++ b/src/cloudflare/resources/addressing/prefixes/delegations.py @@ -7,10 +7,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( diff --git a/src/cloudflare/resources/addressing/prefixes/prefixes.py b/src/cloudflare/resources/addressing/prefixes/prefixes.py index 6c9f5435bec..2cb1ed99c12 100644 --- a/src/cloudflare/resources/addressing/prefixes/prefixes.py +++ b/src/cloudflare/resources/addressing/prefixes/prefixes.py @@ -7,10 +7,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from .delegations import ( DelegationsResource, diff --git a/src/cloudflare/resources/addressing/prefixes/service_bindings.py b/src/cloudflare/resources/addressing/prefixes/service_bindings.py index 053cdd351c4..1517b22c602 100644 --- a/src/cloudflare/resources/addressing/prefixes/service_bindings.py +++ b/src/cloudflare/resources/addressing/prefixes/service_bindings.py @@ -7,10 +7,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -66,8 +63,9 @@ def create( """ Creates a new Service Binding, routing traffic to IPs within the given CIDR to a service running on Cloudflare's network. **Note:** This API may only be used on - prefixes currently configured with a Magic Transit service binding, and only - allows creating service bindings for the Cloudflare CDN or Cloudflare Spectrum. + prefixes currently configured with a Magic Transit/Cloudflare CDN/Cloudflare + Spectrum service binding, and only allows creating upgrade service bindings for + the Cloudflare CDN or Cloudflare Spectrum. Args: account_id: Identifier of a Cloudflare account. @@ -289,8 +287,9 @@ async def create( """ Creates a new Service Binding, routing traffic to IPs within the given CIDR to a service running on Cloudflare's network. **Note:** This API may only be used on - prefixes currently configured with a Magic Transit service binding, and only - allows creating service bindings for the Cloudflare CDN or Cloudflare Spectrum. + prefixes currently configured with a Magic Transit/Cloudflare CDN/Cloudflare + Spectrum service binding, and only allows creating upgrade service bindings for + the Cloudflare CDN or Cloudflare Spectrum. Args: account_id: Identifier of a Cloudflare account. diff --git a/src/cloudflare/resources/addressing/regional_hostnames/regional_hostnames.py b/src/cloudflare/resources/addressing/regional_hostnames/regional_hostnames.py index ed9b3b46be5..f490caebc34 100644 --- a/src/cloudflare/resources/addressing/regional_hostnames/regional_hostnames.py +++ b/src/cloudflare/resources/addressing/regional_hostnames/regional_hostnames.py @@ -15,10 +15,7 @@ AsyncRegionsResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -70,6 +67,7 @@ def create( zone_id: str, hostname: str, region_key: str, + routing: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -85,13 +83,15 @@ def create( [Regional Services](https://developers.cloudflare.com/data-localization/regional-services/get-started/). Args: - zone_id: Identifier + zone_id: Identifier. hostname: DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are supported for one level, e.g `*.example.com` region_key: Identifying key for the region + routing: Configure which routing method to use for the regional hostname + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -108,6 +108,7 @@ def create( { "hostname": hostname, "region_key": region_key, + "routing": routing, }, regional_hostname_create_params.RegionalHostnameCreateParams, ), @@ -136,7 +137,7 @@ def list( List all Regional Hostnames within a zone. Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers @@ -173,7 +174,7 @@ def delete( Delete the region configuration for a specific Regional Hostname. Args: - zone_id: Identifier + zone_id: Identifier. hostname: DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are supported for one level, e.g `*.example.com` @@ -217,7 +218,7 @@ def edit( of a hostname is mutable. Args: - zone_id: Identifier + zone_id: Identifier. hostname: DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are supported for one level, e.g `*.example.com` @@ -265,7 +266,7 @@ def get( Fetch the configuration for a specific Regional Hostname, within a zone. Args: - zone_id: Identifier + zone_id: Identifier. hostname: DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are supported for one level, e.g `*.example.com` @@ -325,6 +326,7 @@ async def create( zone_id: str, hostname: str, region_key: str, + routing: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -340,13 +342,15 @@ async def create( [Regional Services](https://developers.cloudflare.com/data-localization/regional-services/get-started/). Args: - zone_id: Identifier + zone_id: Identifier. hostname: DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are supported for one level, e.g `*.example.com` region_key: Identifying key for the region + routing: Configure which routing method to use for the regional hostname + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -363,6 +367,7 @@ async def create( { "hostname": hostname, "region_key": region_key, + "routing": routing, }, regional_hostname_create_params.RegionalHostnameCreateParams, ), @@ -391,7 +396,7 @@ def list( List all Regional Hostnames within a zone. Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers @@ -428,7 +433,7 @@ async def delete( Delete the region configuration for a specific Regional Hostname. Args: - zone_id: Identifier + zone_id: Identifier. hostname: DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are supported for one level, e.g `*.example.com` @@ -472,7 +477,7 @@ async def edit( of a hostname is mutable. Args: - zone_id: Identifier + zone_id: Identifier. hostname: DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are supported for one level, e.g `*.example.com` @@ -522,7 +527,7 @@ async def get( Fetch the configuration for a specific Regional Hostname, within a zone. Args: - zone_id: Identifier + zone_id: Identifier. hostname: DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are supported for one level, e.g `*.example.com` diff --git a/src/cloudflare/resources/addressing/regional_hostnames/regions.py b/src/cloudflare/resources/addressing/regional_hostnames/regions.py index f0c69f1b81f..77bd67a298d 100644 --- a/src/cloudflare/resources/addressing/regional_hostnames/regions.py +++ b/src/cloudflare/resources/addressing/regional_hostnames/regions.py @@ -55,7 +55,7 @@ def list( List all Regional Services regions available for use by this account. Args: - account_id: Identifier + account_id: Identifier. extra_headers: Send extra headers @@ -112,7 +112,7 @@ def list( List all Regional Services regions available for use by this account. Args: - account_id: Identifier + account_id: Identifier. extra_headers: Send extra headers diff --git a/src/cloudflare/resources/ai/ai.py b/src/cloudflare/resources/ai/ai.py index bbc218bb3ab..7f9f0462bbc 100644 --- a/src/cloudflare/resources/ai/ai.py +++ b/src/cloudflare/resources/ai/ai.py @@ -24,11 +24,7 @@ AsyncAuthorsResourceWithStreamingResponse, ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - required_args, - maybe_transform, - async_maybe_transform, -) +from ..._utils import required_args, maybe_transform, async_maybe_transform from ..._compat import cached_property from ...types.ai import ai_run_params from ..._resource import SyncAPIResource, AsyncAPIResource @@ -234,7 +230,7 @@ def run( [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/). Args: - prompt: A text description of the image you want to generate + prompt: A text description of the audio you want to generate lang: The speech language (e.g., 'en' for English, 'fr' for French). Defaults to 'en' if not specified @@ -501,6 +497,7 @@ def run( functions: Iterable[ai_run_params.MessagesFunction] | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, presence_penalty: float | NotGiven = NOT_GIVEN, + raw: bool | NotGiven = NOT_GIVEN, repetition_penalty: float | NotGiven = NOT_GIVEN, response_format: ai_run_params.MessagesResponseFormat | NotGiven = NOT_GIVEN, seed: int | NotGiven = NOT_GIVEN, @@ -536,11 +533,15 @@ def run( presence_penalty: Increases the likelihood of the model introducing new topics. + raw: If true, a chat template is not applied and you must adhere to the specific + model's expected formatting. + repetition_penalty: Penalty for repeated tokens; higher values discourage repetition. seed: Random seed for reproducibility of the generation. - stream: If true, the response will be streamed back incrementally. + stream: If true, the response will be streamed back incrementally using SSE, Server Sent + Events. temperature: Controls the randomness of the output; higher values produce more random results. @@ -551,7 +552,7 @@ def run( responses more focused; higher values introduce more variety and potential surprises. - top_p: Controls the creativity of the AI's responses by adjusting how many possible + top_p: Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. @@ -726,6 +727,154 @@ def run( """ ... + @overload + def run( + self, + model_name: str, + *, + account_id: str, + image: str, + prompt: str, + frequency_penalty: float | NotGiven = NOT_GIVEN, + ignore_eos: bool | NotGiven = NOT_GIVEN, + max_tokens: int | NotGiven = NOT_GIVEN, + presence_penalty: float | NotGiven = NOT_GIVEN, + repetition_penalty: float | NotGiven = NOT_GIVEN, + seed: float | NotGiven = NOT_GIVEN, + temperature: float | NotGiven = NOT_GIVEN, + top_k: float | NotGiven = NOT_GIVEN, + top_p: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[AIRunResponse]: + """ + This endpoint provides users with the capability to run specific AI models + on-demand. + + By submitting the required input data, users can receive real-time predictions + or results generated by the chosen AI model. The endpoint supports various AI + model types, ensuring flexibility and adaptability for diverse use cases. + + Model specific inputs available in + [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/). + + Args: + image: Image in base64 encoded format. + + prompt: The input text prompt for the model to generate a response. + + frequency_penalty: Decreases the likelihood of the model repeating the same lines verbatim. + + ignore_eos: Whether to ignore the EOS token and continue generating tokens after the EOS + token is generated. + + max_tokens: The maximum number of tokens to generate in the response. + + presence_penalty: Increases the likelihood of the model introducing new topics. + + repetition_penalty: Penalty for repeated tokens; higher values discourage repetition. + + seed: Random seed for reproducibility of the generation. + + temperature: Controls the randomness of the output; higher values produce more random + results. + + top_k: Limits the AI to choose from the top 'k' most probable words. Lower values make + responses more focused; higher values introduce more variety and potential + surprises. + + top_p: Controls the creativity of the AI's responses by adjusting how many possible + words it considers. Lower values make outputs more predictable; higher values + allow for more varied and creative responses. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def run( + self, + model_name: str, + *, + account_id: str, + image: str, + messages: Iterable[ai_run_params.Variant13Message], + frequency_penalty: float | NotGiven = NOT_GIVEN, + ignore_eos: bool | NotGiven = NOT_GIVEN, + max_tokens: int | NotGiven = NOT_GIVEN, + presence_penalty: float | NotGiven = NOT_GIVEN, + repetition_penalty: float | NotGiven = NOT_GIVEN, + seed: float | NotGiven = NOT_GIVEN, + temperature: float | NotGiven = NOT_GIVEN, + top_k: float | NotGiven = NOT_GIVEN, + top_p: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[AIRunResponse]: + """ + This endpoint provides users with the capability to run specific AI models + on-demand. + + By submitting the required input data, users can receive real-time predictions + or results generated by the chosen AI model. The endpoint supports various AI + model types, ensuring flexibility and adaptability for diverse use cases. + + Model specific inputs available in + [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/). + + Args: + image: Image in base64 encoded format. + + messages: An array of message objects representing the conversation history. + + frequency_penalty: Decreases the likelihood of the model repeating the same lines verbatim. + + ignore_eos: Whether to ignore the EOS token and continue generating tokens after the EOS + token is generated. + + max_tokens: The maximum number of tokens to generate in the response. + + presence_penalty: Increases the likelihood of the model introducing new topics. + + repetition_penalty: Penalty for repeated tokens; higher values discourage repetition. + + seed: Random seed for reproducibility of the generation. + + temperature: Controls the randomness of the output; higher values produce more random + results. + + top_k: Limits the AI to choose from the top 'k' most probable words. Lower values make + responses more focused; higher values introduce more variety and potential + surprises. + + top_p: Controls the creativity of the AI's responses by adjusting how many possible + words it considers. Lower values make outputs more predictable; higher values + allow for more varied and creative responses. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + @required_args( ["account_id", "text"], ["account_id", "prompt"], @@ -735,6 +884,8 @@ def run( ["account_id", "messages"], ["account_id", "target_lang", "text"], ["account_id", "input_text"], + ["account_id", "image", "prompt"], + ["account_id", "image", "messages"], ) def run( self, @@ -745,7 +896,7 @@ def run( prompt: str | NotGiven = NOT_GIVEN, guidance: float | NotGiven = NOT_GIVEN, height: int | NotGiven = NOT_GIVEN, - image: Iterable[float] | NotGiven = NOT_GIVEN, + image: Iterable[float] | str | NotGiven = NOT_GIVEN, image_b64: str | NotGiven = NOT_GIVEN, mask: Iterable[float] | NotGiven = NOT_GIVEN, negative_prompt: str | NotGiven = NOT_GIVEN, @@ -773,6 +924,7 @@ def run( tools: Iterable[ai_run_params.MessagesTool] | NotGiven = NOT_GIVEN, input_text: str | NotGiven = NOT_GIVEN, max_length: int | NotGiven = NOT_GIVEN, + ignore_eos: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -822,6 +974,7 @@ def run( "tools": tools, "input_text": input_text, "max_length": max_length, + "ignore_eos": ignore_eos, }, ai_run_params.AIRunParams, ), @@ -1012,7 +1165,7 @@ async def run( [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/). Args: - prompt: A text description of the image you want to generate + prompt: A text description of the audio you want to generate lang: The speech language (e.g., 'en' for English, 'fr' for French). Defaults to 'en' if not specified @@ -1279,6 +1432,7 @@ async def run( functions: Iterable[ai_run_params.MessagesFunction] | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, presence_penalty: float | NotGiven = NOT_GIVEN, + raw: bool | NotGiven = NOT_GIVEN, repetition_penalty: float | NotGiven = NOT_GIVEN, response_format: ai_run_params.MessagesResponseFormat | NotGiven = NOT_GIVEN, seed: int | NotGiven = NOT_GIVEN, @@ -1314,11 +1468,15 @@ async def run( presence_penalty: Increases the likelihood of the model introducing new topics. + raw: If true, a chat template is not applied and you must adhere to the specific + model's expected formatting. + repetition_penalty: Penalty for repeated tokens; higher values discourage repetition. seed: Random seed for reproducibility of the generation. - stream: If true, the response will be streamed back incrementally. + stream: If true, the response will be streamed back incrementally using SSE, Server Sent + Events. temperature: Controls the randomness of the output; higher values produce more random results. @@ -1329,7 +1487,7 @@ async def run( responses more focused; higher values introduce more variety and potential surprises. - top_p: Controls the creativity of the AI's responses by adjusting how many possible + top_p: Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses. @@ -1504,6 +1662,154 @@ async def run( """ ... + @overload + async def run( + self, + model_name: str, + *, + account_id: str, + image: str, + prompt: str, + frequency_penalty: float | NotGiven = NOT_GIVEN, + ignore_eos: bool | NotGiven = NOT_GIVEN, + max_tokens: int | NotGiven = NOT_GIVEN, + presence_penalty: float | NotGiven = NOT_GIVEN, + repetition_penalty: float | NotGiven = NOT_GIVEN, + seed: float | NotGiven = NOT_GIVEN, + temperature: float | NotGiven = NOT_GIVEN, + top_k: float | NotGiven = NOT_GIVEN, + top_p: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[AIRunResponse]: + """ + This endpoint provides users with the capability to run specific AI models + on-demand. + + By submitting the required input data, users can receive real-time predictions + or results generated by the chosen AI model. The endpoint supports various AI + model types, ensuring flexibility and adaptability for diverse use cases. + + Model specific inputs available in + [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/). + + Args: + image: Image in base64 encoded format. + + prompt: The input text prompt for the model to generate a response. + + frequency_penalty: Decreases the likelihood of the model repeating the same lines verbatim. + + ignore_eos: Whether to ignore the EOS token and continue generating tokens after the EOS + token is generated. + + max_tokens: The maximum number of tokens to generate in the response. + + presence_penalty: Increases the likelihood of the model introducing new topics. + + repetition_penalty: Penalty for repeated tokens; higher values discourage repetition. + + seed: Random seed for reproducibility of the generation. + + temperature: Controls the randomness of the output; higher values produce more random + results. + + top_k: Limits the AI to choose from the top 'k' most probable words. Lower values make + responses more focused; higher values introduce more variety and potential + surprises. + + top_p: Controls the creativity of the AI's responses by adjusting how many possible + words it considers. Lower values make outputs more predictable; higher values + allow for more varied and creative responses. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def run( + self, + model_name: str, + *, + account_id: str, + image: str, + messages: Iterable[ai_run_params.Variant13Message], + frequency_penalty: float | NotGiven = NOT_GIVEN, + ignore_eos: bool | NotGiven = NOT_GIVEN, + max_tokens: int | NotGiven = NOT_GIVEN, + presence_penalty: float | NotGiven = NOT_GIVEN, + repetition_penalty: float | NotGiven = NOT_GIVEN, + seed: float | NotGiven = NOT_GIVEN, + temperature: float | NotGiven = NOT_GIVEN, + top_k: float | NotGiven = NOT_GIVEN, + top_p: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Optional[AIRunResponse]: + """ + This endpoint provides users with the capability to run specific AI models + on-demand. + + By submitting the required input data, users can receive real-time predictions + or results generated by the chosen AI model. The endpoint supports various AI + model types, ensuring flexibility and adaptability for diverse use cases. + + Model specific inputs available in + [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/). + + Args: + image: Image in base64 encoded format. + + messages: An array of message objects representing the conversation history. + + frequency_penalty: Decreases the likelihood of the model repeating the same lines verbatim. + + ignore_eos: Whether to ignore the EOS token and continue generating tokens after the EOS + token is generated. + + max_tokens: The maximum number of tokens to generate in the response. + + presence_penalty: Increases the likelihood of the model introducing new topics. + + repetition_penalty: Penalty for repeated tokens; higher values discourage repetition. + + seed: Random seed for reproducibility of the generation. + + temperature: Controls the randomness of the output; higher values produce more random + results. + + top_k: Limits the AI to choose from the top 'k' most probable words. Lower values make + responses more focused; higher values introduce more variety and potential + surprises. + + top_p: Controls the creativity of the AI's responses by adjusting how many possible + words it considers. Lower values make outputs more predictable; higher values + allow for more varied and creative responses. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + @required_args( ["account_id", "text"], ["account_id", "prompt"], @@ -1513,6 +1819,8 @@ async def run( ["account_id", "messages"], ["account_id", "target_lang", "text"], ["account_id", "input_text"], + ["account_id", "image", "prompt"], + ["account_id", "image", "messages"], ) async def run( self, @@ -1523,7 +1831,7 @@ async def run( prompt: str | NotGiven = NOT_GIVEN, guidance: float | NotGiven = NOT_GIVEN, height: int | NotGiven = NOT_GIVEN, - image: Iterable[float] | NotGiven = NOT_GIVEN, + image: Iterable[float] | str | NotGiven = NOT_GIVEN, image_b64: str | NotGiven = NOT_GIVEN, mask: Iterable[float] | NotGiven = NOT_GIVEN, negative_prompt: str | NotGiven = NOT_GIVEN, @@ -1551,6 +1859,7 @@ async def run( tools: Iterable[ai_run_params.MessagesTool] | NotGiven = NOT_GIVEN, input_text: str | NotGiven = NOT_GIVEN, max_length: int | NotGiven = NOT_GIVEN, + ignore_eos: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1600,6 +1909,7 @@ async def run( "tools": tools, "input_text": input_text, "max_length": max_length, + "ignore_eos": ignore_eos, }, ai_run_params.AIRunParams, ), diff --git a/src/cloudflare/resources/ai/finetunes/assets.py b/src/cloudflare/resources/ai/finetunes/assets.py index 7df434bb081..f1da603332b 100644 --- a/src/cloudflare/resources/ai/finetunes/assets.py +++ b/src/cloudflare/resources/ai/finetunes/assets.py @@ -7,12 +7,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes -from ...._utils import ( - extract_files, - maybe_transform, - deepcopy_minimal, - async_maybe_transform, -) +from ...._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( diff --git a/src/cloudflare/resources/ai/finetunes/finetunes.py b/src/cloudflare/resources/ai/finetunes/finetunes.py index 51bac25f1b5..47de3973b44 100644 --- a/src/cloudflare/resources/ai/finetunes/finetunes.py +++ b/src/cloudflare/resources/ai/finetunes/finetunes.py @@ -23,10 +23,7 @@ AsyncPublicResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ....types.ai import finetune_create_params from ...._resource import SyncAPIResource, AsyncAPIResource diff --git a/src/cloudflare/resources/ai/models/schema.py b/src/cloudflare/resources/ai/models/schema.py index 9b62769bf19..a388ffb8beb 100644 --- a/src/cloudflare/resources/ai/models/schema.py +++ b/src/cloudflare/resources/ai/models/schema.py @@ -7,10 +7,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( diff --git a/src/cloudflare/resources/ai_gateway/ai_gateway.py b/src/cloudflare/resources/ai_gateway/ai_gateway.py index d21818fc074..d665650c3d4 100644 --- a/src/cloudflare/resources/ai_gateway/ai_gateway.py +++ b/src/cloudflare/resources/ai_gateway/ai_gateway.py @@ -24,10 +24,7 @@ AsyncURLsResourceWithStreamingResponse, ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from .datasets import ( DatasetsResource, AsyncDatasetsResource, diff --git a/src/cloudflare/resources/ai_gateway/datasets.py b/src/cloudflare/resources/ai_gateway/datasets.py index afed3ec86ef..1f7a6f69882 100644 --- a/src/cloudflare/resources/ai_gateway/datasets.py +++ b/src/cloudflare/resources/ai_gateway/datasets.py @@ -7,10 +7,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( diff --git a/src/cloudflare/resources/ai_gateway/evaluations.py b/src/cloudflare/resources/ai_gateway/evaluations.py index 9fadf2aa944..b57f840d9b3 100644 --- a/src/cloudflare/resources/ai_gateway/evaluations.py +++ b/src/cloudflare/resources/ai_gateway/evaluations.py @@ -7,10 +7,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( diff --git a/src/cloudflare/resources/ai_gateway/logs.py b/src/cloudflare/resources/ai_gateway/logs.py index 0daa36fc2c6..d2336f16603 100644 --- a/src/cloudflare/resources/ai_gateway/logs.py +++ b/src/cloudflare/resources/ai_gateway/logs.py @@ -9,10 +9,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( diff --git a/src/cloudflare/resources/alerting/destinations/webhooks.py b/src/cloudflare/resources/alerting/destinations/webhooks.py index e5d7f0d1b9c..09c887d2d93 100644 --- a/src/cloudflare/resources/alerting/destinations/webhooks.py +++ b/src/cloudflare/resources/alerting/destinations/webhooks.py @@ -7,10 +7,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( diff --git a/src/cloudflare/resources/alerting/policies.py b/src/cloudflare/resources/alerting/policies.py index 650d09f1800..352c836cc12 100644 --- a/src/cloudflare/resources/alerting/policies.py +++ b/src/cloudflare/resources/alerting/policies.py @@ -8,10 +8,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -68,12 +65,14 @@ def create( "block_notification_block_removed", "block_notification_new_block", "block_notification_review_rejected", + "bot_traffic_basic_alert", "brand_protection_alert", "brand_protection_digest", "clickhouse_alert_fw_anomaly", "clickhouse_alert_fw_ent_anomaly", "cloudforce_one_request_notification", "custom_analytics", + "custom_bot_detection_alert", "custom_ssl_certificate_event_type", "dedicated_ssl_certificate_event_type", "device_connectivity_anomaly_alert", @@ -214,12 +213,14 @@ def update( "block_notification_block_removed", "block_notification_new_block", "block_notification_review_rejected", + "bot_traffic_basic_alert", "brand_protection_alert", "brand_protection_digest", "clickhouse_alert_fw_anomaly", "clickhouse_alert_fw_ent_anomaly", "cloudforce_one_request_notification", "custom_analytics", + "custom_bot_detection_alert", "custom_ssl_certificate_event_type", "dedicated_ssl_certificate_event_type", "device_connectivity_anomaly_alert", @@ -503,12 +504,14 @@ async def create( "block_notification_block_removed", "block_notification_new_block", "block_notification_review_rejected", + "bot_traffic_basic_alert", "brand_protection_alert", "brand_protection_digest", "clickhouse_alert_fw_anomaly", "clickhouse_alert_fw_ent_anomaly", "cloudforce_one_request_notification", "custom_analytics", + "custom_bot_detection_alert", "custom_ssl_certificate_event_type", "dedicated_ssl_certificate_event_type", "device_connectivity_anomaly_alert", @@ -649,12 +652,14 @@ async def update( "block_notification_block_removed", "block_notification_new_block", "block_notification_review_rejected", + "bot_traffic_basic_alert", "brand_protection_alert", "brand_protection_digest", "clickhouse_alert_fw_anomaly", "clickhouse_alert_fw_ent_anomaly", "cloudforce_one_request_notification", "custom_analytics", + "custom_bot_detection_alert", "custom_ssl_certificate_event_type", "dedicated_ssl_certificate_event_type", "device_connectivity_anomaly_alert", diff --git a/src/cloudflare/resources/api_gateway/configurations.py b/src/cloudflare/resources/api_gateway/configurations.py index 450f5205f0d..7e9a062efaa 100644 --- a/src/cloudflare/resources/api_gateway/configurations.py +++ b/src/cloudflare/resources/api_gateway/configurations.py @@ -8,10 +8,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -65,7 +62,7 @@ def update( Set configuration properties Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers @@ -105,7 +102,7 @@ def get( Retrieve information about specific configuration properties Args: - zone_id: Identifier + zone_id: Identifier. properties: Requests information about certain properties. @@ -169,7 +166,7 @@ async def update( Set configuration properties Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers @@ -209,7 +206,7 @@ async def get( Retrieve information about specific configuration properties Args: - zone_id: Identifier + zone_id: Identifier. properties: Requests information about certain properties. diff --git a/src/cloudflare/resources/api_gateway/discovery/discovery.py b/src/cloudflare/resources/api_gateway/discovery/discovery.py index 9c3152dd49b..a55f40cb832 100644 --- a/src/cloudflare/resources/api_gateway/discovery/discovery.py +++ b/src/cloudflare/resources/api_gateway/discovery/discovery.py @@ -70,7 +70,7 @@ def get( schemas Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers @@ -135,7 +135,7 @@ async def get( schemas Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers diff --git a/src/cloudflare/resources/api_gateway/discovery/operations.py b/src/cloudflare/resources/api_gateway/discovery/operations.py index f7a8556479a..db65d954216 100644 --- a/src/cloudflare/resources/api_gateway/discovery/operations.py +++ b/src/cloudflare/resources/api_gateway/discovery/operations.py @@ -8,10 +8,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -62,7 +59,7 @@ def list( method: List[str] | NotGiven = NOT_GIVEN, order: Literal["host", "method", "endpoint", "traffic_stats.requests", "traffic_stats.last_updated"] | NotGiven = NOT_GIVEN, - origin: Literal["ML", "SessionIdentifier"] | NotGiven = NOT_GIVEN, + origin: Literal["ML", "SessionIdentifier", "LabelDiscovery"] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, per_page: int | NotGiven = NOT_GIVEN, state: Literal["review", "saved", "ignored"] | NotGiven = NOT_GIVEN, @@ -77,7 +74,7 @@ def list( Retrieve the most up to date view of discovered operations Args: - zone_id: Identifier + zone_id: Identifier. diff: When `true`, only return API Discovery results that are not saved into API Shield Endpoint Management @@ -165,7 +162,7 @@ def bulk_edit( Update the `state` on one or more discovered operations Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers @@ -207,9 +204,9 @@ def edit( Update the `state` on a discovered operation Args: - zone_id: Identifier + zone_id: Identifier. - operation_id: UUID + operation_id: UUID. state: Mark state of operation in API Discovery @@ -273,7 +270,7 @@ def list( method: List[str] | NotGiven = NOT_GIVEN, order: Literal["host", "method", "endpoint", "traffic_stats.requests", "traffic_stats.last_updated"] | NotGiven = NOT_GIVEN, - origin: Literal["ML", "SessionIdentifier"] | NotGiven = NOT_GIVEN, + origin: Literal["ML", "SessionIdentifier", "LabelDiscovery"] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, per_page: int | NotGiven = NOT_GIVEN, state: Literal["review", "saved", "ignored"] | NotGiven = NOT_GIVEN, @@ -288,7 +285,7 @@ def list( Retrieve the most up to date view of discovered operations Args: - zone_id: Identifier + zone_id: Identifier. diff: When `true`, only return API Discovery results that are not saved into API Shield Endpoint Management @@ -376,7 +373,7 @@ async def bulk_edit( Update the `state` on one or more discovered operations Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers @@ -418,9 +415,9 @@ async def edit( Update the `state` on a discovered operation Args: - zone_id: Identifier + zone_id: Identifier. - operation_id: UUID + operation_id: UUID. state: Mark state of operation in API Discovery diff --git a/src/cloudflare/resources/api_gateway/expression_template/fallthrough.py b/src/cloudflare/resources/api_gateway/expression_template/fallthrough.py index 1cb60fb64c1..828ebad4865 100644 --- a/src/cloudflare/resources/api_gateway/expression_template/fallthrough.py +++ b/src/cloudflare/resources/api_gateway/expression_template/fallthrough.py @@ -7,10 +7,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -63,7 +60,7 @@ def create( Generate fallthrough WAF expression template from a set of API hosts Args: - zone_id: Identifier + zone_id: Identifier. hosts: List of hosts to be targeted in the expression @@ -127,7 +124,7 @@ async def create( Generate fallthrough WAF expression template from a set of API hosts Args: - zone_id: Identifier + zone_id: Identifier. hosts: List of hosts to be targeted in the expression diff --git a/src/cloudflare/resources/api_gateway/operations/operations.py b/src/cloudflare/resources/api_gateway/operations/operations.py index eae381497ff..5e168e8238f 100644 --- a/src/cloudflare/resources/api_gateway/operations/operations.py +++ b/src/cloudflare/resources/api_gateway/operations/operations.py @@ -8,10 +8,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -94,7 +91,7 @@ def create( last_updated date. Args: - zone_id: Identifier + zone_id: Identifier. endpoint: The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during @@ -158,7 +155,7 @@ def list( Retrieve information about all operations on a zone Args: - zone_id: Identifier + zone_id: Identifier. direction: Direction to order results. @@ -230,9 +227,9 @@ def delete( Delete an operation Args: - zone_id: Identifier + zone_id: Identifier. - operation_id: UUID + operation_id: UUID. extra_headers: Send extra headers @@ -275,7 +272,7 @@ def bulk_create( its last_updated date. Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers @@ -313,7 +310,7 @@ def bulk_delete( Delete multiple operations Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers @@ -350,9 +347,9 @@ def get( Retrieve information about an operation Args: - zone_id: Identifier + zone_id: Identifier. - operation_id: UUID + operation_id: UUID. feature: Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description @@ -431,7 +428,7 @@ async def create( last_updated date. Args: - zone_id: Identifier + zone_id: Identifier. endpoint: The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during @@ -495,7 +492,7 @@ def list( Retrieve information about all operations on a zone Args: - zone_id: Identifier + zone_id: Identifier. direction: Direction to order results. @@ -567,9 +564,9 @@ async def delete( Delete an operation Args: - zone_id: Identifier + zone_id: Identifier. - operation_id: UUID + operation_id: UUID. extra_headers: Send extra headers @@ -612,7 +609,7 @@ def bulk_create( its last_updated date. Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers @@ -650,7 +647,7 @@ async def bulk_delete( Delete multiple operations Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers @@ -687,9 +684,9 @@ async def get( Retrieve information about an operation Args: - zone_id: Identifier + zone_id: Identifier. - operation_id: UUID + operation_id: UUID. feature: Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description diff --git a/src/cloudflare/resources/api_gateway/operations/schema_validation.py b/src/cloudflare/resources/api_gateway/operations/schema_validation.py index d08ebba4175..39718458f87 100644 --- a/src/cloudflare/resources/api_gateway/operations/schema_validation.py +++ b/src/cloudflare/resources/api_gateway/operations/schema_validation.py @@ -8,10 +8,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -72,9 +69,9 @@ def update( Updates operation-level schema validation settings on the zone Args: - zone_id: Identifier + zone_id: Identifier. - operation_id: UUID + operation_id: UUID. mitigation_action: When set, this applies a mitigation action to this operation @@ -124,7 +121,7 @@ def edit( Updates multiple operation-level schema validation settings on the zone Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers @@ -165,9 +162,9 @@ def get( Retrieves operation-level schema validation settings on the zone Args: - zone_id: Identifier + zone_id: Identifier. - operation_id: UUID + operation_id: UUID. extra_headers: Send extra headers @@ -227,9 +224,9 @@ async def update( Updates operation-level schema validation settings on the zone Args: - zone_id: Identifier + zone_id: Identifier. - operation_id: UUID + operation_id: UUID. mitigation_action: When set, this applies a mitigation action to this operation @@ -279,7 +276,7 @@ async def edit( Updates multiple operation-level schema validation settings on the zone Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers @@ -322,9 +319,9 @@ async def get( Retrieves operation-level schema validation settings on the zone Args: - zone_id: Identifier + zone_id: Identifier. - operation_id: UUID + operation_id: UUID. extra_headers: Send extra headers diff --git a/src/cloudflare/resources/api_gateway/schemas.py b/src/cloudflare/resources/api_gateway/schemas.py index 79611e37e5d..61db8233e2d 100644 --- a/src/cloudflare/resources/api_gateway/schemas.py +++ b/src/cloudflare/resources/api_gateway/schemas.py @@ -8,10 +8,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -65,7 +62,7 @@ def list( Retrieve operations and features as OpenAPI schemas Args: - zone_id: Identifier + zone_id: Identifier. feature: Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description @@ -140,7 +137,7 @@ async def list( Retrieve operations and features as OpenAPI schemas Args: - zone_id: Identifier + zone_id: Identifier. feature: Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description diff --git a/src/cloudflare/resources/api_gateway/settings/schema_validation.py b/src/cloudflare/resources/api_gateway/settings/schema_validation.py index ccb54128e03..37610d80629 100644 --- a/src/cloudflare/resources/api_gateway/settings/schema_validation.py +++ b/src/cloudflare/resources/api_gateway/settings/schema_validation.py @@ -8,10 +8,7 @@ import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -64,7 +61,7 @@ def update( Updates zone level schema validation settings on the zone Args: - zone_id: Identifier + zone_id: Identifier. validation_default_mitigation_action: The default mitigation action used when there is no mitigation action defined on the operation @@ -126,7 +123,7 @@ def edit( Updates zone level schema validation settings on the zone Args: - zone_id: Identifier + zone_id: Identifier. validation_default_mitigation_action: The default mitigation action used when there is no mitigation action defined on the operation Mitigation actions are as follows: @@ -187,7 +184,7 @@ def get( Retrieves zone level schema validation settings currently set on the zone Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers @@ -245,7 +242,7 @@ async def update( Updates zone level schema validation settings on the zone Args: - zone_id: Identifier + zone_id: Identifier. validation_default_mitigation_action: The default mitigation action used when there is no mitigation action defined on the operation @@ -307,7 +304,7 @@ async def edit( Updates zone level schema validation settings on the zone Args: - zone_id: Identifier + zone_id: Identifier. validation_default_mitigation_action: The default mitigation action used when there is no mitigation action defined on the operation Mitigation actions are as follows: @@ -368,7 +365,7 @@ async def get( Retrieves zone level schema validation settings currently set on the zone Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers diff --git a/src/cloudflare/resources/api_gateway/user_schemas/hosts.py b/src/cloudflare/resources/api_gateway/user_schemas/hosts.py index aa9fcadb55f..eba45a77d93 100644 --- a/src/cloudflare/resources/api_gateway/user_schemas/hosts.py +++ b/src/cloudflare/resources/api_gateway/user_schemas/hosts.py @@ -59,7 +59,7 @@ def list( Retrieve schema hosts in a zone Args: - zone_id: Identifier + zone_id: Identifier. page: Page number of paginated results. @@ -132,7 +132,7 @@ def list( Retrieve schema hosts in a zone Args: - zone_id: Identifier + zone_id: Identifier. page: Page number of paginated results. diff --git a/src/cloudflare/resources/api_gateway/user_schemas/operations.py b/src/cloudflare/resources/api_gateway/user_schemas/operations.py index 5a9c28fa03d..a75cd28dbfb 100644 --- a/src/cloudflare/resources/api_gateway/user_schemas/operations.py +++ b/src/cloudflare/resources/api_gateway/user_schemas/operations.py @@ -70,7 +70,7 @@ def list( Shield Endpoint Management will be returned as full operations. Args: - zone_id: Identifier + zone_id: Identifier. endpoint: Filter results to only include endpoints containing this pattern. @@ -173,7 +173,7 @@ def list( Shield Endpoint Management will be returned as full operations. Args: - zone_id: Identifier + zone_id: Identifier. endpoint: Filter results to only include endpoints containing this pattern. diff --git a/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py b/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py index 35c37f69fb6..3c2921267ff 100644 --- a/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py +++ b/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py @@ -16,12 +16,7 @@ AsyncHostsResourceWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes -from ...._utils import ( - extract_files, - maybe_transform, - deepcopy_minimal, - async_maybe_transform, -) +from ...._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform from ...._compat import cached_property from .operations import ( OperationsResource, @@ -101,7 +96,7 @@ def create( Upload a schema to a zone Args: - zone_id: Identifier + zone_id: Identifier. file: Schema file bytes @@ -167,7 +162,7 @@ def list( Retrieve information about all schemas on a zone Args: - zone_id: Identifier + zone_id: Identifier. omit_source: Omit the source-files of schemas and only retrieve their meta-data. @@ -224,7 +219,7 @@ def delete( Delete a schema Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers @@ -263,7 +258,7 @@ def edit( Enable validation for a schema Args: - zone_id: Identifier + zone_id: Identifier. validation_enabled: Flag whether schema is enabled for validation. @@ -311,7 +306,7 @@ def get( Retrieve information about a specific schema on a zone Args: - zone_id: Identifier + zone_id: Identifier. omit_source: Omit the source-files of schemas and only retrieve their meta-data. @@ -388,7 +383,7 @@ async def create( Upload a schema to a zone Args: - zone_id: Identifier + zone_id: Identifier. file: Schema file bytes @@ -454,7 +449,7 @@ def list( Retrieve information about all schemas on a zone Args: - zone_id: Identifier + zone_id: Identifier. omit_source: Omit the source-files of schemas and only retrieve their meta-data. @@ -511,7 +506,7 @@ async def delete( Delete a schema Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers @@ -550,7 +545,7 @@ async def edit( Enable validation for a schema Args: - zone_id: Identifier + zone_id: Identifier. validation_enabled: Flag whether schema is enabled for validation. @@ -598,7 +593,7 @@ async def get( Retrieve information about a specific schema on a zone Args: - zone_id: Identifier + zone_id: Identifier. omit_source: Omit the source-files of schemas and only retrieve their meta-data. diff --git a/src/cloudflare/resources/argo/smart_routing.py b/src/cloudflare/resources/argo/smart_routing.py index 66ae9a42e3a..28c30e54c30 100644 --- a/src/cloudflare/resources/argo/smart_routing.py +++ b/src/cloudflare/resources/argo/smart_routing.py @@ -8,10 +8,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( diff --git a/src/cloudflare/resources/argo/tiered_caching.py b/src/cloudflare/resources/argo/tiered_caching.py index a598a0d4f6a..5d512f70a6a 100644 --- a/src/cloudflare/resources/argo/tiered_caching.py +++ b/src/cloudflare/resources/argo/tiered_caching.py @@ -8,10 +8,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( diff --git a/src/cloudflare/resources/bot_management.py b/src/cloudflare/resources/bot_management.py index f9875019fe6..f3a541ea1f7 100644 --- a/src/cloudflare/resources/bot_management.py +++ b/src/cloudflare/resources/bot_management.py @@ -8,11 +8,7 @@ import httpx from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - required_args, - maybe_transform, - async_maybe_transform, -) +from .._utils import required_args, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -56,6 +52,7 @@ def update( *, zone_id: str, ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN, + crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN, enable_js: bool | NotGiven = NOT_GIVEN, fight_mode: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -129,10 +126,12 @@ def update( ``` Args: - zone_id: Identifier + zone_id: Identifier. ai_bots_protection: Enable rule to block AI Scrapers and Crawlers. + crawler_protection: Enable rule to punish AI Scrapers and Crawlers via a link maze. + enable_js: Use lightweight, invisible JavaScript detections to improve Bot Management. [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). @@ -154,6 +153,7 @@ def update( *, zone_id: str, ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN, + crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN, enable_js: bool | NotGiven = NOT_GIVEN, optimize_wordpress: bool | NotGiven = NOT_GIVEN, sbfm_definitely_automated: Literal["allow", "block", "managed_challenge"] | NotGiven = NOT_GIVEN, @@ -230,10 +230,12 @@ def update( ``` Args: - zone_id: Identifier + zone_id: Identifier. ai_bots_protection: Enable rule to block AI Scrapers and Crawlers. + crawler_protection: Enable rule to punish AI Scrapers and Crawlers via a link maze. + enable_js: Use lightweight, invisible JavaScript detections to improve Bot Management. [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). @@ -263,6 +265,7 @@ def update( *, zone_id: str, ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN, + crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN, enable_js: bool | NotGiven = NOT_GIVEN, optimize_wordpress: bool | NotGiven = NOT_GIVEN, sbfm_definitely_automated: Literal["allow", "block", "managed_challenge"] | NotGiven = NOT_GIVEN, @@ -340,10 +343,12 @@ def update( ``` Args: - zone_id: Identifier + zone_id: Identifier. ai_bots_protection: Enable rule to block AI Scrapers and Crawlers. + crawler_protection: Enable rule to punish AI Scrapers and Crawlers via a link maze. + enable_js: Use lightweight, invisible JavaScript detections to improve Bot Management. [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). @@ -376,6 +381,7 @@ def update( zone_id: str, ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN, auto_update_model: bool | NotGiven = NOT_GIVEN, + crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN, enable_js: bool | NotGiven = NOT_GIVEN, suppress_session_score: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -449,7 +455,7 @@ def update( ``` Args: - zone_id: Identifier + zone_id: Identifier. ai_bots_protection: Enable rule to block AI Scrapers and Crawlers. @@ -457,6 +463,8 @@ def update( they are released. [Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes) + crawler_protection: Enable rule to punish AI Scrapers and Crawlers via a link maze. + enable_js: Use lightweight, invisible JavaScript detections to improve Bot Management. [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). @@ -479,6 +487,7 @@ def update( *, zone_id: str, ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN, + crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN, enable_js: bool | NotGiven = NOT_GIVEN, fight_mode: bool | NotGiven = NOT_GIVEN, optimize_wordpress: bool | NotGiven = NOT_GIVEN, @@ -504,6 +513,7 @@ def update( body=maybe_transform( { "ai_bots_protection": ai_bots_protection, + "crawler_protection": crawler_protection, "enable_js": enable_js, "fight_mode": fight_mode, "optimize_wordpress": optimize_wordpress, @@ -544,7 +554,7 @@ def get( Retrieve a zone's Bot Management Config Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers @@ -600,6 +610,7 @@ async def update( *, zone_id: str, ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN, + crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN, enable_js: bool | NotGiven = NOT_GIVEN, fight_mode: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -673,10 +684,12 @@ async def update( ``` Args: - zone_id: Identifier + zone_id: Identifier. ai_bots_protection: Enable rule to block AI Scrapers and Crawlers. + crawler_protection: Enable rule to punish AI Scrapers and Crawlers via a link maze. + enable_js: Use lightweight, invisible JavaScript detections to improve Bot Management. [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). @@ -698,6 +711,7 @@ async def update( *, zone_id: str, ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN, + crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN, enable_js: bool | NotGiven = NOT_GIVEN, optimize_wordpress: bool | NotGiven = NOT_GIVEN, sbfm_definitely_automated: Literal["allow", "block", "managed_challenge"] | NotGiven = NOT_GIVEN, @@ -774,10 +788,12 @@ async def update( ``` Args: - zone_id: Identifier + zone_id: Identifier. ai_bots_protection: Enable rule to block AI Scrapers and Crawlers. + crawler_protection: Enable rule to punish AI Scrapers and Crawlers via a link maze. + enable_js: Use lightweight, invisible JavaScript detections to improve Bot Management. [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). @@ -807,6 +823,7 @@ async def update( *, zone_id: str, ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN, + crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN, enable_js: bool | NotGiven = NOT_GIVEN, optimize_wordpress: bool | NotGiven = NOT_GIVEN, sbfm_definitely_automated: Literal["allow", "block", "managed_challenge"] | NotGiven = NOT_GIVEN, @@ -884,10 +901,12 @@ async def update( ``` Args: - zone_id: Identifier + zone_id: Identifier. ai_bots_protection: Enable rule to block AI Scrapers and Crawlers. + crawler_protection: Enable rule to punish AI Scrapers and Crawlers via a link maze. + enable_js: Use lightweight, invisible JavaScript detections to improve Bot Management. [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). @@ -920,6 +939,7 @@ async def update( zone_id: str, ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN, auto_update_model: bool | NotGiven = NOT_GIVEN, + crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN, enable_js: bool | NotGiven = NOT_GIVEN, suppress_session_score: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -993,7 +1013,7 @@ async def update( ``` Args: - zone_id: Identifier + zone_id: Identifier. ai_bots_protection: Enable rule to block AI Scrapers and Crawlers. @@ -1001,6 +1021,8 @@ async def update( they are released. [Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes) + crawler_protection: Enable rule to punish AI Scrapers and Crawlers via a link maze. + enable_js: Use lightweight, invisible JavaScript detections to improve Bot Management. [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). @@ -1023,6 +1045,7 @@ async def update( *, zone_id: str, ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN, + crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN, enable_js: bool | NotGiven = NOT_GIVEN, fight_mode: bool | NotGiven = NOT_GIVEN, optimize_wordpress: bool | NotGiven = NOT_GIVEN, @@ -1048,6 +1071,7 @@ async def update( body=await async_maybe_transform( { "ai_bots_protection": ai_bots_protection, + "crawler_protection": crawler_protection, "enable_js": enable_js, "fight_mode": fight_mode, "optimize_wordpress": optimize_wordpress, @@ -1088,7 +1112,7 @@ async def get( Retrieve a zone's Bot Management Config Args: - zone_id: Identifier + zone_id: Identifier. extra_headers: Send extra headers diff --git a/src/cloudflare/resources/botnet_feed/asn.py b/src/cloudflare/resources/botnet_feed/asn.py index 15e06d69a8c..5fd0185a673 100755 --- a/src/cloudflare/resources/botnet_feed/asn.py +++ b/src/cloudflare/resources/botnet_feed/asn.py @@ -8,10 +8,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -68,7 +65,7 @@ def day_report( previous day. Args: - account_id: Identifier + account_id: Identifier. extra_headers: Send extra headers @@ -110,7 +107,7 @@ def full_report( registered to user account. Args: - account_id: Identifier + account_id: Identifier. extra_headers: Send extra headers @@ -174,7 +171,7 @@ async def day_report( previous day. Args: - account_id: Identifier + account_id: Identifier. extra_headers: Send extra headers @@ -216,7 +213,7 @@ async def full_report( registered to user account. Args: - account_id: Identifier + account_id: Identifier. extra_headers: Send extra headers diff --git a/src/cloudflare/resources/botnet_feed/configs/asn.py b/src/cloudflare/resources/botnet_feed/configs/asn.py index e2f27d024b6..db2b4a80978 100755 --- a/src/cloudflare/resources/botnet_feed/configs/asn.py +++ b/src/cloudflare/resources/botnet_feed/configs/asn.py @@ -59,7 +59,7 @@ def delete( Delete an ASN from botnet threat feed for a given user. Args: - account_id: Identifier + account_id: Identifier. extra_headers: Send extra headers @@ -98,7 +98,7 @@ def get( Gets a list of all ASNs registered for a user for the DDoS Botnet Feed API. Args: - account_id: Identifier + account_id: Identifier. extra_headers: Send extra headers @@ -159,7 +159,7 @@ async def delete( Delete an ASN from botnet threat feed for a given user. Args: - account_id: Identifier + account_id: Identifier. extra_headers: Send extra headers @@ -198,7 +198,7 @@ async def get( Gets a list of all ASNs registered for a user for the DDoS Botnet Feed API. Args: - account_id: Identifier + account_id: Identifier. extra_headers: Send extra headers diff --git a/src/cloudflare/resources/brand_protection.py b/src/cloudflare/resources/brand_protection.py index a23a6034443..659ee0c7e7c 100644 --- a/src/cloudflare/resources/brand_protection.py +++ b/src/cloudflare/resources/brand_protection.py @@ -7,10 +7,7 @@ import httpx from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -61,12 +58,12 @@ def submit( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[Submit]: """ - Submit suspicious URL for scanning + Submit suspicious URL for scanning. Args: - account_id: Identifier + account_id: Identifier. - url: URL(s) to filter submissions results by + url: URL(s) to filter submissions results by. extra_headers: Send extra headers @@ -108,7 +105,7 @@ def url_info( Gets phishing details about a URL. Args: - account_id: Identifier + account_id: Identifier. url: Submission URL(s) to filter submission results by. @@ -177,12 +174,12 @@ async def submit( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> Optional[Submit]: """ - Submit suspicious URL for scanning + Submit suspicious URL for scanning. Args: - account_id: Identifier + account_id: Identifier. - url: URL(s) to filter submissions results by + url: URL(s) to filter submissions results by. extra_headers: Send extra headers @@ -224,7 +221,7 @@ async def url_info( Gets phishing details about a URL. Args: - account_id: Identifier + account_id: Identifier. url: Submission URL(s) to filter submission results by. diff --git a/src/cloudflare/resources/browser_rendering/__init__.py b/src/cloudflare/resources/browser_rendering/__init__.py index d42a51797d4..ca6102ced41 100644 --- a/src/cloudflare/resources/browser_rendering/__init__.py +++ b/src/cloudflare/resources/browser_rendering/__init__.py @@ -8,6 +8,22 @@ PDFResourceWithStreamingResponse, AsyncPDFResourceWithStreamingResponse, ) +from .json import ( + JsonResource, + AsyncJsonResource, + JsonResourceWithRawResponse, + AsyncJsonResourceWithRawResponse, + JsonResourceWithStreamingResponse, + AsyncJsonResourceWithStreamingResponse, +) +from .links import ( + LinksResource, + AsyncLinksResource, + LinksResourceWithRawResponse, + AsyncLinksResourceWithRawResponse, + LinksResourceWithStreamingResponse, + AsyncLinksResourceWithStreamingResponse, +) from .scrape import ( ScrapeResource, AsyncScrapeResource, @@ -24,6 +40,14 @@ ContentResourceWithStreamingResponse, AsyncContentResourceWithStreamingResponse, ) +from .markdown import ( + MarkdownResource, + AsyncMarkdownResource, + MarkdownResourceWithRawResponse, + AsyncMarkdownResourceWithRawResponse, + MarkdownResourceWithStreamingResponse, + AsyncMarkdownResourceWithStreamingResponse, +) from .snapshot import ( SnapshotResource, AsyncSnapshotResource, @@ -80,6 +104,24 @@ "AsyncSnapshotResourceWithRawResponse", "SnapshotResourceWithStreamingResponse", "AsyncSnapshotResourceWithStreamingResponse", + "JsonResource", + "AsyncJsonResource", + "JsonResourceWithRawResponse", + "AsyncJsonResourceWithRawResponse", + "JsonResourceWithStreamingResponse", + "AsyncJsonResourceWithStreamingResponse", + "LinksResource", + "AsyncLinksResource", + "LinksResourceWithRawResponse", + "AsyncLinksResourceWithRawResponse", + "LinksResourceWithStreamingResponse", + "AsyncLinksResourceWithStreamingResponse", + "MarkdownResource", + "AsyncMarkdownResource", + "MarkdownResourceWithRawResponse", + "AsyncMarkdownResourceWithRawResponse", + "MarkdownResourceWithStreamingResponse", + "AsyncMarkdownResourceWithStreamingResponse", "BrowserRenderingResource", "AsyncBrowserRenderingResource", "BrowserRenderingResourceWithRawResponse", diff --git a/src/cloudflare/resources/browser_rendering/browser_rendering.py b/src/cloudflare/resources/browser_rendering/browser_rendering.py index b597be3813f..bee931f57df 100644 --- a/src/cloudflare/resources/browser_rendering/browser_rendering.py +++ b/src/cloudflare/resources/browser_rendering/browser_rendering.py @@ -10,6 +10,22 @@ PDFResourceWithStreamingResponse, AsyncPDFResourceWithStreamingResponse, ) +from .json import ( + JsonResource, + AsyncJsonResource, + JsonResourceWithRawResponse, + AsyncJsonResourceWithRawResponse, + JsonResourceWithStreamingResponse, + AsyncJsonResourceWithStreamingResponse, +) +from .links import ( + LinksResource, + AsyncLinksResource, + LinksResourceWithRawResponse, + AsyncLinksResourceWithRawResponse, + LinksResourceWithStreamingResponse, + AsyncLinksResourceWithStreamingResponse, +) from .scrape import ( ScrapeResource, AsyncScrapeResource, @@ -26,6 +42,14 @@ ContentResourceWithStreamingResponse, AsyncContentResourceWithStreamingResponse, ) +from .markdown import ( + MarkdownResource, + AsyncMarkdownResource, + MarkdownResourceWithRawResponse, + AsyncMarkdownResourceWithRawResponse, + MarkdownResourceWithStreamingResponse, + AsyncMarkdownResourceWithStreamingResponse, +) from .snapshot import ( SnapshotResource, AsyncSnapshotResource, @@ -69,6 +93,18 @@ def screenshot(self) -> ScreenshotResource: def snapshot(self) -> SnapshotResource: return SnapshotResource(self._client) + @cached_property + def json(self) -> JsonResource: + return JsonResource(self._client) + + @cached_property + def links(self) -> LinksResource: + return LinksResource(self._client) + + @cached_property + def markdown(self) -> MarkdownResource: + return MarkdownResource(self._client) + @cached_property def with_raw_response(self) -> BrowserRenderingResourceWithRawResponse: """ @@ -110,6 +146,18 @@ def screenshot(self) -> AsyncScreenshotResource: def snapshot(self) -> AsyncSnapshotResource: return AsyncSnapshotResource(self._client) + @cached_property + def json(self) -> AsyncJsonResource: + return AsyncJsonResource(self._client) + + @cached_property + def links(self) -> AsyncLinksResource: + return AsyncLinksResource(self._client) + + @cached_property + def markdown(self) -> AsyncMarkdownResource: + return AsyncMarkdownResource(self._client) + @cached_property def with_raw_response(self) -> AsyncBrowserRenderingResourceWithRawResponse: """ @@ -154,6 +202,18 @@ def screenshot(self) -> ScreenshotResourceWithRawResponse: def snapshot(self) -> SnapshotResourceWithRawResponse: return SnapshotResourceWithRawResponse(self._browser_rendering.snapshot) + @cached_property + def json(self) -> JsonResourceWithRawResponse: + return JsonResourceWithRawResponse(self._browser_rendering.json) + + @cached_property + def links(self) -> LinksResourceWithRawResponse: + return LinksResourceWithRawResponse(self._browser_rendering.links) + + @cached_property + def markdown(self) -> MarkdownResourceWithRawResponse: + return MarkdownResourceWithRawResponse(self._browser_rendering.markdown) + class AsyncBrowserRenderingResourceWithRawResponse: def __init__(self, browser_rendering: AsyncBrowserRenderingResource) -> None: @@ -179,6 +239,18 @@ def screenshot(self) -> AsyncScreenshotResourceWithRawResponse: def snapshot(self) -> AsyncSnapshotResourceWithRawResponse: return AsyncSnapshotResourceWithRawResponse(self._browser_rendering.snapshot) + @cached_property + def json(self) -> AsyncJsonResourceWithRawResponse: + return AsyncJsonResourceWithRawResponse(self._browser_rendering.json) + + @cached_property + def links(self) -> AsyncLinksResourceWithRawResponse: + return AsyncLinksResourceWithRawResponse(self._browser_rendering.links) + + @cached_property + def markdown(self) -> AsyncMarkdownResourceWithRawResponse: + return AsyncMarkdownResourceWithRawResponse(self._browser_rendering.markdown) + class BrowserRenderingResourceWithStreamingResponse: def __init__(self, browser_rendering: BrowserRenderingResource) -> None: @@ -204,6 +276,18 @@ def screenshot(self) -> ScreenshotResourceWithStreamingResponse: def snapshot(self) -> SnapshotResourceWithStreamingResponse: return SnapshotResourceWithStreamingResponse(self._browser_rendering.snapshot) + @cached_property + def json(self) -> JsonResourceWithStreamingResponse: + return JsonResourceWithStreamingResponse(self._browser_rendering.json) + + @cached_property + def links(self) -> LinksResourceWithStreamingResponse: + return LinksResourceWithStreamingResponse(self._browser_rendering.links) + + @cached_property + def markdown(self) -> MarkdownResourceWithStreamingResponse: + return MarkdownResourceWithStreamingResponse(self._browser_rendering.markdown) + class AsyncBrowserRenderingResourceWithStreamingResponse: def __init__(self, browser_rendering: AsyncBrowserRenderingResource) -> None: @@ -228,3 +312,15 @@ def screenshot(self) -> AsyncScreenshotResourceWithStreamingResponse: @cached_property def snapshot(self) -> AsyncSnapshotResourceWithStreamingResponse: return AsyncSnapshotResourceWithStreamingResponse(self._browser_rendering.snapshot) + + @cached_property + def json(self) -> AsyncJsonResourceWithStreamingResponse: + return AsyncJsonResourceWithStreamingResponse(self._browser_rendering.json) + + @cached_property + def links(self) -> AsyncLinksResourceWithStreamingResponse: + return AsyncLinksResourceWithStreamingResponse(self._browser_rendering.links) + + @cached_property + def markdown(self) -> AsyncMarkdownResourceWithStreamingResponse: + return AsyncMarkdownResourceWithStreamingResponse(self._browser_rendering.markdown) diff --git a/src/cloudflare/resources/browser_rendering/content.py b/src/cloudflare/resources/browser_rendering/content.py index 45a438dcb8f..6ff78d62f8b 100644 --- a/src/cloudflare/resources/browser_rendering/content.py +++ b/src/cloudflare/resources/browser_rendering/content.py @@ -8,10 +8,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -53,6 +50,7 @@ def create( *, account_id: str, cache_ttl: float | NotGiven = NOT_GIVEN, + action_timeout: float | NotGiven = NOT_GIVEN, add_script_tag: Iterable[content_create_params.AddScriptTag] | NotGiven = NOT_GIVEN, add_style_tag: Iterable[content_create_params.AddStyleTag] | NotGiven = NOT_GIVEN, allow_request_pattern: List[str] | NotGiven = NOT_GIVEN, @@ -133,6 +131,10 @@ def create( cache_ttl: Cache TTL default is 5s. Set to 0 to disable. + action_timeout: The maximum duration allowed for the browser action to complete after the page + has loaded (such as taking screenshots, extracting content, or generating PDFs). + If this time limit is exceeded, the action stops and returns a timeout error. + add_script_tag: Adds a `