Skip to content

Commit

Permalink
Merge pull request #482 from cloudflare/release-please--branches--mai…
Browse files Browse the repository at this point in the history
…n--changes--next

release: 3.0.0-beta.10
  • Loading branch information
jacobbednarz authored Jun 18, 2024
2 parents 5cb63bc + 7bd7ef6 commit 4e01b1c
Show file tree
Hide file tree
Showing 690 changed files with 59,787 additions and 9,239 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

USER vscode

RUN curl -sSf https://rye-up.com/get | RYE_VERSION="0.24.0" RYE_INSTALL_OPTION="--yes" bash
RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.24.0" RYE_INSTALL_OPTION="--yes" bash
ENV PATH=/home/vscode/.rye/shims:$PATH

RUN echo "[[ -d .venv ]] && source .venv/bin/activate" >> /home/vscode/.bashrc
22 changes: 6 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,17 @@ jobs:

- name: Install Rye
run: |
curl -sSf https://rye-up.com/get | bash
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: 0.24.0
RYE_INSTALL_OPTION: '--yes'

- name: Install dependencies
run: |
rye sync --all-features
- name: Run ruff
run: |
rye run check:ruff
run: rye sync --all-features

- name: Run type checking
run: |
rye run typecheck
- name: Ensure importable
run: |
rye run python -c 'import cloudflare'
- name: Run lints
run: ./scripts/lint
test:
name: test
runs-on: ubuntu-latest
Expand All @@ -48,7 +38,7 @@ jobs:

- name: Install Rye
run: |
curl -sSf https://rye-up.com/get | bash
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: 0.24.0
Expand All @@ -68,7 +58,7 @@ jobs:

- name: Install Rye
run: |
curl -sSf https://rye-up.com/get | bash
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: 0.24.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- name: Install Rye
run: |
curl -sSf https://rye-up.com/get | bash
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: 0.24.0
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "3.0.0-beta.9"
".": "3.0.0-beta.10"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1274
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-07ec76fab00de3d6227209faf0af1ed586cde9e2f243c13d3db555da20f13d99.yml
configured_endpoints: 1348
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-49d54760f87326f9200c777f867e4ea579c92a43f481207ae252db9748c9b07b.yml
307 changes: 307 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### With Rye

We use [Rye](https://rye-up.com/) to manage dependencies so we highly recommend [installing it](https://rye-up.com/guide/installation/) as it will automatically provision a Python environment with the expected Python version.
We use [Rye](https://rye.astral.sh/) to manage dependencies so we highly recommend [installing it](https://rye.astral.sh/guide/installation/) as it will automatically provision a Python environment with the expected Python version.

After installing Rye, you'll just have to run this command:

Expand Down
27 changes: 27 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Security Policy

## Reporting Security Issues

This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken.

To report a security issue, please contact the Stainless team at [email protected].

## Responsible Disclosure

We appreciate the efforts of security researchers and individuals who help us maintain the security of
SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible
disclosure practices by allowing us a reasonable amount of time to investigate and address the issue
before making any information public.

## Reporting Non-SDK Related Security Issues

If you encounter security issues that are not directly related to SDKs but pertain to the services
or products provided by Cloudflare please follow the respective company's security reporting guidelines.

### Cloudflare Terms and Policies

Please contact [email protected] for any questions or concerns regarding security of our services.

---

Thank you for helping us keep the SDKs and systems they interact with secure.
743 changes: 583 additions & 160 deletions api.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ show_error_codes = True
# Exclude _files.py because mypy isn't smart enough to apply
# the correct type narrowing and as this is an internal module
# it's fine to just use Pyright.
exclude = ^(src/cloudflare/_files\.py|_dev/.*\.py|src/cloudflare/resources/zero_trust/identity_providers\.py|src/cloudflare/resources/zero_trust/access/applications/applications\.py|src/cloudflare/resources/workers/ai\.py)$
exclude = ^(src/cloudflare/_files\.py|_dev/.*\.py|src/cloudflare/resources/zero_trust/identity_providers\.py|src/cloudflare/resources/zero_trust/access/applications/applications\.py|src/cloudflare/resources/workers/ai\.py|src/cloudflare/resources/magic_transit/apps\.py)$

strict_equality = True
implicit_reexport = True
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "cloudflare"
version = "3.0.0-beta.9"
version = "3.0.0-beta.10"
description = "The official Python library for the cloudflare API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
6 changes: 3 additions & 3 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ pluggy==1.3.0
# via pytest
py==1.11.0
# via pytest
pydantic==2.4.2
pydantic==2.7.1
# via cloudflare
pydantic-core==2.10.1
pydantic-core==2.18.2
# via pydantic
pyright==1.1.359
pyright==1.1.364
pytest==7.1.1
# via pytest-asyncio
pytest-asyncio==0.21.1
Expand Down
4 changes: 2 additions & 2 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ httpx==0.25.2
idna==3.4
# via anyio
# via httpx
pydantic==2.4.2
pydantic==2.7.1
# via cloudflare
pydantic-core==2.10.1
pydantic-core==2.18.2
# via pydantic
sniffio==1.3.0
# via anyio
Expand Down
2 changes: 1 addition & 1 deletion scripts/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ echo "==> Installing Python dependencies…"
# experimental uv support makes installations significantly faster
rye config --set-bool behavior.use-uv=true

rye sync
rye sync --all-features
2 changes: 1 addition & 1 deletion scripts/format
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ set -e

cd "$(dirname "$0")/.."

echo "==> Running formatters"
rye run format

4 changes: 4 additions & 0 deletions scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ set -e

cd "$(dirname "$0")/.."

echo "==> Running lints"
rye run lint

echo "==> Making sure it imports"
rye run python -c 'import cloudflare'

1 change: 0 additions & 1 deletion scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,5 @@ else
echo
fi

# Run tests
echo "==> Running tests"
rye run pytest "$@"
8 changes: 7 additions & 1 deletion src/cloudflare/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def _build_request(
raise RuntimeError(f"Unexpected JSON data type, {type(json_data)}, cannot merge with `extra_body`")

headers = self._build_headers(options)
params = _merge_mappings(self._custom_query, options.params)
params = _merge_mappings(self.default_query, options.params)
content_type = headers.get("Content-Type")

# If the given Content-Type header is multipart/form-data then it
Expand Down Expand Up @@ -592,6 +592,12 @@ def default_headers(self) -> dict[str, str | Omit]:
**self._custom_headers,
}

@property
def default_query(self) -> dict[str, object]:
return {
**self._custom_query,
}

def _validate_headers(
self,
headers: Headers, # noqa: ARG002
Expand Down
16 changes: 16 additions & 0 deletions src/cloudflare/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class Cloudflare(SyncAPIClient):
kv: resources.KVResource
durable_objects: resources.DurableObjectsResource
queues: resources.QueuesResource
api_gateway: resources.APIGatewayResource
managed_headers: resources.ManagedHeadersResource
page_shield: resources.PageShieldResource
rulesets: resources.RulesetsResource
Expand Down Expand Up @@ -129,6 +130,7 @@ class Cloudflare(SyncAPIClient):
cloudforce_one: resources.CloudforceOneResource
event_notifications: resources.EventNotificationsResource
ai_gateway: resources.AIGatewayResource
iam: resources.IAMResource
with_raw_response: CloudflareWithRawResponse
with_streaming_response: CloudflareWithStreamedResponse

Expand Down Expand Up @@ -242,6 +244,7 @@ def __init__(
self.kv = resources.KVResource(self)
self.durable_objects = resources.DurableObjectsResource(self)
self.queues = resources.QueuesResource(self)
self.api_gateway = resources.APIGatewayResource(self)
self.managed_headers = resources.ManagedHeadersResource(self)
self.page_shield = resources.PageShieldResource(self)
self.rulesets = resources.RulesetsResource(self)
Expand Down Expand Up @@ -286,6 +289,7 @@ def __init__(
self.cloudforce_one = resources.CloudforceOneResource(self)
self.event_notifications = resources.EventNotificationsResource(self)
self.ai_gateway = resources.AIGatewayResource(self)
self.iam = resources.IAMResource(self)
self.with_raw_response = CloudflareWithRawResponse(self)
self.with_streaming_response = CloudflareWithStreamedResponse(self)

Expand Down Expand Up @@ -502,6 +506,7 @@ class AsyncCloudflare(AsyncAPIClient):
kv: resources.AsyncKVResource
durable_objects: resources.AsyncDurableObjectsResource
queues: resources.AsyncQueuesResource
api_gateway: resources.AsyncAPIGatewayResource
managed_headers: resources.AsyncManagedHeadersResource
page_shield: resources.AsyncPageShieldResource
rulesets: resources.AsyncRulesetsResource
Expand Down Expand Up @@ -546,6 +551,7 @@ class AsyncCloudflare(AsyncAPIClient):
cloudforce_one: resources.AsyncCloudforceOneResource
event_notifications: resources.AsyncEventNotificationsResource
ai_gateway: resources.AsyncAIGatewayResource
iam: resources.AsyncIAMResource
with_raw_response: AsyncCloudflareWithRawResponse
with_streaming_response: AsyncCloudflareWithStreamedResponse

Expand Down Expand Up @@ -659,6 +665,7 @@ def __init__(
self.kv = resources.AsyncKVResource(self)
self.durable_objects = resources.AsyncDurableObjectsResource(self)
self.queues = resources.AsyncQueuesResource(self)
self.api_gateway = resources.AsyncAPIGatewayResource(self)
self.managed_headers = resources.AsyncManagedHeadersResource(self)
self.page_shield = resources.AsyncPageShieldResource(self)
self.rulesets = resources.AsyncRulesetsResource(self)
Expand Down Expand Up @@ -703,6 +710,7 @@ def __init__(
self.cloudforce_one = resources.AsyncCloudforceOneResource(self)
self.event_notifications = resources.AsyncEventNotificationsResource(self)
self.ai_gateway = resources.AsyncAIGatewayResource(self)
self.iam = resources.AsyncIAMResource(self)
self.with_raw_response = AsyncCloudflareWithRawResponse(self)
self.with_streaming_response = AsyncCloudflareWithStreamedResponse(self)

Expand Down Expand Up @@ -926,6 +934,7 @@ def __init__(self, client: Cloudflare) -> None:
self.kv = resources.KVResourceWithRawResponse(client.kv)
self.durable_objects = resources.DurableObjectsResourceWithRawResponse(client.durable_objects)
self.queues = resources.QueuesResourceWithRawResponse(client.queues)
self.api_gateway = resources.APIGatewayResourceWithRawResponse(client.api_gateway)
self.managed_headers = resources.ManagedHeadersResourceWithRawResponse(client.managed_headers)
self.page_shield = resources.PageShieldResourceWithRawResponse(client.page_shield)
self.rulesets = resources.RulesetsResourceWithRawResponse(client.rulesets)
Expand Down Expand Up @@ -974,6 +983,7 @@ def __init__(self, client: Cloudflare) -> None:
self.cloudforce_one = resources.CloudforceOneResourceWithRawResponse(client.cloudforce_one)
self.event_notifications = resources.EventNotificationsResourceWithRawResponse(client.event_notifications)
self.ai_gateway = resources.AIGatewayResourceWithRawResponse(client.ai_gateway)
self.iam = resources.IAMResourceWithRawResponse(client.iam)


class AsyncCloudflareWithRawResponse:
Expand Down Expand Up @@ -1024,6 +1034,7 @@ def __init__(self, client: AsyncCloudflare) -> None:
self.kv = resources.AsyncKVResourceWithRawResponse(client.kv)
self.durable_objects = resources.AsyncDurableObjectsResourceWithRawResponse(client.durable_objects)
self.queues = resources.AsyncQueuesResourceWithRawResponse(client.queues)
self.api_gateway = resources.AsyncAPIGatewayResourceWithRawResponse(client.api_gateway)
self.managed_headers = resources.AsyncManagedHeadersResourceWithRawResponse(client.managed_headers)
self.page_shield = resources.AsyncPageShieldResourceWithRawResponse(client.page_shield)
self.rulesets = resources.AsyncRulesetsResourceWithRawResponse(client.rulesets)
Expand Down Expand Up @@ -1074,6 +1085,7 @@ def __init__(self, client: AsyncCloudflare) -> None:
self.cloudforce_one = resources.AsyncCloudforceOneResourceWithRawResponse(client.cloudforce_one)
self.event_notifications = resources.AsyncEventNotificationsResourceWithRawResponse(client.event_notifications)
self.ai_gateway = resources.AsyncAIGatewayResourceWithRawResponse(client.ai_gateway)
self.iam = resources.AsyncIAMResourceWithRawResponse(client.iam)


class CloudflareWithStreamedResponse:
Expand Down Expand Up @@ -1124,6 +1136,7 @@ def __init__(self, client: Cloudflare) -> None:
self.kv = resources.KVResourceWithStreamingResponse(client.kv)
self.durable_objects = resources.DurableObjectsResourceWithStreamingResponse(client.durable_objects)
self.queues = resources.QueuesResourceWithStreamingResponse(client.queues)
self.api_gateway = resources.APIGatewayResourceWithStreamingResponse(client.api_gateway)
self.managed_headers = resources.ManagedHeadersResourceWithStreamingResponse(client.managed_headers)
self.page_shield = resources.PageShieldResourceWithStreamingResponse(client.page_shield)
self.rulesets = resources.RulesetsResourceWithStreamingResponse(client.rulesets)
Expand Down Expand Up @@ -1174,6 +1187,7 @@ def __init__(self, client: Cloudflare) -> None:
self.cloudforce_one = resources.CloudforceOneResourceWithStreamingResponse(client.cloudforce_one)
self.event_notifications = resources.EventNotificationsResourceWithStreamingResponse(client.event_notifications)
self.ai_gateway = resources.AIGatewayResourceWithStreamingResponse(client.ai_gateway)
self.iam = resources.IAMResourceWithStreamingResponse(client.iam)


class AsyncCloudflareWithStreamedResponse:
Expand Down Expand Up @@ -1230,6 +1244,7 @@ def __init__(self, client: AsyncCloudflare) -> None:
self.kv = resources.AsyncKVResourceWithStreamingResponse(client.kv)
self.durable_objects = resources.AsyncDurableObjectsResourceWithStreamingResponse(client.durable_objects)
self.queues = resources.AsyncQueuesResourceWithStreamingResponse(client.queues)
self.api_gateway = resources.AsyncAPIGatewayResourceWithStreamingResponse(client.api_gateway)
self.managed_headers = resources.AsyncManagedHeadersResourceWithStreamingResponse(client.managed_headers)
self.page_shield = resources.AsyncPageShieldResourceWithStreamingResponse(client.page_shield)
self.rulesets = resources.AsyncRulesetsResourceWithStreamingResponse(client.rulesets)
Expand Down Expand Up @@ -1282,6 +1297,7 @@ def __init__(self, client: AsyncCloudflare) -> None:
client.event_notifications
)
self.ai_gateway = resources.AsyncAIGatewayResourceWithStreamingResponse(client.ai_gateway)
self.iam = resources.AsyncIAMResourceWithStreamingResponse(client.iam)


Client = Cloudflare
Expand Down
Loading

0 comments on commit 4e01b1c

Please sign in to comment.