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
+65Lines changed: 65 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -118,6 +118,71 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ
118
118
119
119
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
120
120
121
+
## Pagination
122
+
123
+
List methods in the Arcade API are paginated.
124
+
125
+
This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:
126
+
127
+
```python
128
+
from arcadepy import Arcade
129
+
130
+
client = Arcade()
131
+
132
+
all_user_connections = []
133
+
# Automatically fetches more pages as needed.
134
+
for user_connection in client.admin.user_connections.list():
135
+
# Do something with user_connection here
136
+
all_user_connections.append(user_connection)
137
+
print(all_user_connections)
138
+
```
139
+
140
+
Or, asynchronously:
141
+
142
+
```python
143
+
import asyncio
144
+
from arcadepy import AsyncArcade
145
+
146
+
client = AsyncArcade()
147
+
148
+
149
+
asyncdefmain() -> None:
150
+
all_user_connections = []
151
+
# Iterate through items across all pages, issuing requests as needed.
152
+
asyncfor user_connection in client.admin.user_connections.list():
153
+
all_user_connections.append(user_connection)
154
+
print(all_user_connections)
155
+
156
+
157
+
asyncio.run(main())
158
+
```
159
+
160
+
Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:
0 commit comments