You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,6 +71,7 @@ A client owns an HTTP connection pool, so it should be closed when you are done
71
71
import asyncio
72
72
from qca import AsyncManaged
73
73
74
+
74
75
asyncdefmain() -> None:
75
76
asyncwith AsyncManaged() as client:
76
77
asyncfor agent in client.agents.list(limit=20):
@@ -79,6 +80,7 @@ async def main() -> None:
79
80
first_page =await client.sessions.list(limit=10)
80
81
print(first_page.data)
81
82
83
+
82
84
asyncio.run(main())
83
85
```
84
86
@@ -218,8 +220,8 @@ print(identity._request_id)
218
220
Certain errors are retried twice by default with exponential backoff. GET and HEAD requests, and any request carrying an idempotency key, are retried on connection errors, 408, 429, and 5xx; other requests are retried on 429 only. A 409 is never retried automatically, and an SSE stream that has already been established is never retried. Within those rules the SDK honors `x-should-retry` and a valid `Retry-After-Ms` or `Retry-After`.
219
221
220
222
```python
221
-
client = Forward(max_retries=0) # disable for all requests
222
-
client.with_options(max_retries=5).sessions.list() # or override per call site
223
+
client = Forward(max_retries=0) # disable for all requests
224
+
client.with_options(max_retries=5).sessions.list() # or override per call site
223
225
```
224
226
225
227
`with_options` returns a separately configured client that shares the original connection pool, so closing either one closes that pool.
@@ -230,7 +232,7 @@ The default timeout is 10 seconds to connect and 60 seconds for each subsequent
230
232
231
233
```python
232
234
client = Forward(timeout=30.0)
233
-
client.sessions.retrieve("sess-id", timeout=5.0) # per request
235
+
client.sessions.retrieve("sess-id", timeout=5.0) # per request
234
236
```
235
237
236
238
Timeouts apply per HTTP phase and per attempt, not to the whole call including retries. End-to-end deadlines are the caller's responsibility; async code can wrap a call in `asyncio.wait_for`.
@@ -250,10 +252,10 @@ List methods return a page that iterates across page boundaries for you.
250
252
251
253
```python
252
254
page = client.sessions.list(limit=20)
253
-
print(page.data) # just this page
255
+
print(page.data) # just this page
254
256
print(page.has_next_page())
255
257
256
-
for session in page: # fetches subsequent pages as needed
258
+
for session in page: # fetches subsequent pages as needed
0 commit comments