Skip to content

Commit d39b828

Browse files
feat: OpenAPI spec update via Stainless API (#57)
1 parent fb925aa commit d39b828

File tree

4,959 files changed

+282769
-304374
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,959 files changed

+282769
-304374
lines changed

.devcontainer/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
33

44
USER vscode
55

6-
RUN curl -sSf https://rye-up.com/get | RYE_VERSION="0.15.2" RYE_INSTALL_OPTION="--yes" bash
6+
RUN curl -sSf https://rye-up.com/get | RYE_VERSION="0.24.0" RYE_INSTALL_OPTION="--yes" bash
77
ENV PATH=/home/vscode/.rye/shims:$PATH
88

99
RUN echo "[[ -d .venv ]] && source .venv/bin/activate" >> /home/vscode/.bashrc

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ jobs:
1414

1515

1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818

1919
- name: Install Rye
2020
run: |
2121
curl -sSf https://rye-up.com/get | bash
2222
echo "$HOME/.rye/shims" >> $GITHUB_PATH
2323
env:
24-
RYE_VERSION: 0.15.2
24+
RYE_VERSION: 0.24.0
2525
RYE_INSTALL_OPTION: "--yes"
2626

2727
- name: Install dependencies

.github/workflows/publish-pypi.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
curl -sSf https://rye-up.com/get | bash
2222
echo "$HOME/.rye/shims" >> $GITHUB_PATH
2323
env:
24-
RYE_VERSION: 0.15.2
24+
RYE_VERSION: 0.24.0
2525
RYE_INSTALL_OPTION: "--yes"
2626

2727
- name: Publish to PyPI

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 1146
1+
configured_endpoints: 1249

README.md

+25-38
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ client = Cloudflare(
3030
)
3131

3232
zone_create_response = client.zones.create(
33-
account={
34-
"id": "023e105f4ecef8ad9ca31a8372d0c353"
35-
},
33+
account={"id": "023e105f4ecef8ad9ca31a8372d0c353"},
3634
name="example.com",
3735
type="full",
3836
)
@@ -41,7 +39,7 @@ print(zone_create_response.id)
4139

4240
While you can provide a `api_email` keyword argument,
4341
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
44-
to add `CLOUDFLARE_EMAIL="dev@cloudflare.com"` to your `.env` file
42+
to add `CLOUDFLARE_EMAIL="user@example.com"` to your `.env` file
4543
so that your API Email is not stored in source control.
4644

4745
## Async usage
@@ -58,15 +56,15 @@ client = AsyncCloudflare(
5856
api_email=os.environ.get("CLOUDFLARE_EMAIL"),
5957
)
6058

59+
6160
async def main() -> None:
62-
zone_create_response = await client.zones.create(
63-
account={
64-
"id": "023e105f4ecef8ad9ca31a8372d0c353"
65-
},
66-
name="example.com",
67-
type="full",
68-
)
69-
print(zone_create_response.id)
61+
zone_create_response = await client.zones.create(
62+
account={"id": "023e105f4ecef8ad9ca31a8372d0c353"},
63+
name="example.com",
64+
type="full",
65+
)
66+
print(zone_create_response.id)
67+
7068

7169
asyncio.run(main())
7270
```
@@ -98,16 +96,12 @@ from cloudflare import Cloudflare
9896
client = Cloudflare()
9997

10098
try:
101-
client.zones.create(
102-
account={
103-
"id": "023e105f4ecef8ad9ca31a8372d0c353"
104-
},
105-
name="example.com",
106-
type="full",
99+
client.zones.get(
100+
"023e105f4ecef8ad9ca31a8372d0c353",
107101
)
108102
except cloudflare.APIConnectionError as e:
109103
print("The server could not be reached")
110-
print(e.__cause__) # an underlying Exception, likely raised within httpx.
104+
print(e.__cause__) # an underlying Exception, likely raised within httpx.
111105
except cloudflare.RateLimitError as e:
112106
print("A 429 status code was received; we should back off a bit.")
113107
except cloudflare.APIStatusError as e:
@@ -147,12 +141,8 @@ client = Cloudflare(
147141
)
148142

149143
# Or, configure per-request:
150-
client.with_options(max_retries = 5).zones.create(
151-
account={
152-
"id": "023e105f4ecef8ad9ca31a8372d0c353"
153-
},
154-
name="example.com",
155-
type="full",
144+
client.with_options(max_retries=5).zones.get(
145+
"023e105f4ecef8ad9ca31a8372d0c353",
156146
)
157147
```
158148

@@ -176,12 +166,8 @@ client = Cloudflare(
176166
)
177167

178168
# Override per-request:
179-
client.with_options(timeout = 5 * 1000).zones.create(
180-
account={
181-
"id": "023e105f4ecef8ad9ca31a8372d0c353"
182-
},
183-
name="example.com",
184-
type="full",
169+
client.with_options(timeout=5 * 1000).zones.edit(
170+
"023e105f4ecef8ad9ca31a8372d0c353",
185171
)
186172
```
187173

@@ -246,16 +232,14 @@ To stream the response body, use `.with_streaming_response` instead, which requi
246232

247233
```python
248234
with client.zones.with_streaming_response.create(
249-
account={
250-
"id": "023e105f4ecef8ad9ca31a8372d0c353"
251-
},
235+
account={"id": "023e105f4ecef8ad9ca31a8372d0c353"},
252236
name="example.com",
253237
type="full",
254-
) as response :
255-
print(response.headers.get('X-My-Header'))
238+
) as response:
239+
print(response.headers.get("X-My-Header"))
256240

257241
for line in response.iter_lines():
258-
print(line)
242+
print(line)
259243
```
260244

261245
The context manager is required so that the response will reliably be closed.
@@ -275,7 +259,10 @@ from cloudflare import Cloudflare
275259
client = Cloudflare(
276260
# Or use the `CLOUDFLARE_BASE_URL` env var
277261
base_url="http://my.test.server.example.com:8083",
278-
http_client=httpx.Client(proxies="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")),
262+
http_client=httpx.Client(
263+
proxies="http://my.test.proxy.example.com",
264+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
265+
),
279266
)
280267
```
281268

0 commit comments

Comments
 (0)