Skip to content

Commit ca45cc5

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat: OpenAPI spec update via Stainless API (#23)
1 parent 4b6524e commit ca45cc5

File tree

3,269 files changed

+19253
-41648
lines changed

Some content is hidden

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

3,269 files changed

+19253
-41648
lines changed

README.md

+23-30
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
)
@@ -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
```
@@ -99,15 +97,13 @@ client = Cloudflare()
9997

10098
try:
10199
client.zones.create(
102-
account={
103-
"id": "023e105f4ecef8ad9ca31a8372d0c353"
104-
},
100+
account={"id": "023e105f4ecef8ad9ca31a8372d0c353"},
105101
name="example.com",
106102
type="full",
107103
)
108104
except cloudflare.APIConnectionError as e:
109105
print("The server could not be reached")
110-
print(e.__cause__) # an underlying Exception, likely raised within httpx.
106+
print(e.__cause__) # an underlying Exception, likely raised within httpx.
111107
except cloudflare.RateLimitError as e:
112108
print("A 429 status code was received; we should back off a bit.")
113109
except cloudflare.APIStatusError as e:
@@ -147,10 +143,8 @@ client = Cloudflare(
147143
)
148144

149145
# Or, configure per-request:
150-
client.with_options(max_retries = 5).zones.create(
151-
account={
152-
"id": "023e105f4ecef8ad9ca31a8372d0c353"
153-
},
146+
client.with_options(max_retries=5).zones.create(
147+
account={"id": "023e105f4ecef8ad9ca31a8372d0c353"},
154148
name="example.com",
155149
type="full",
156150
)
@@ -176,10 +170,8 @@ client = Cloudflare(
176170
)
177171

178172
# Override per-request:
179-
client.with_options(timeout = 5 * 1000).zones.create(
180-
account={
181-
"id": "023e105f4ecef8ad9ca31a8372d0c353"
182-
},
173+
client.with_options(timeout=5 * 1000).zones.create(
174+
account={"id": "023e105f4ecef8ad9ca31a8372d0c353"},
183175
name="example.com",
184176
type="full",
185177
)
@@ -246,16 +238,14 @@ To stream the response body, use `.with_streaming_response` instead, which requi
246238

247239
```python
248240
with client.zones.with_streaming_response.create(
249-
account={
250-
"id": "023e105f4ecef8ad9ca31a8372d0c353"
251-
},
241+
account={"id": "023e105f4ecef8ad9ca31a8372d0c353"},
252242
name="example.com",
253243
type="full",
254-
) as response :
255-
print(response.headers.get('X-My-Header'))
244+
) as response:
245+
print(response.headers.get("X-My-Header"))
256246

257247
for line in response.iter_lines():
258-
print(line)
248+
print(line)
259249
```
260250

261251
The context manager is required so that the response will reliably be closed.
@@ -275,7 +265,10 @@ from cloudflare import Cloudflare
275265
client = Cloudflare(
276266
# Or use the `CLOUDFLARE_BASE_URL` env var
277267
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")),
268+
http_client=httpx.Client(
269+
proxies="http://my.test.proxy.example.com",
270+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
271+
),
279272
)
280273
```
281274

0 commit comments

Comments
 (0)