We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0bbcb67 commit e80a36dCopy full SHA for e80a36d
polygon/rest/base.py
@@ -207,6 +207,9 @@ def _paginate_iter(
207
result_key: str = "results",
208
options: Optional[RequestOptionBuilder] = None,
209
):
210
+ limit = params.get("limit")
211
+ yielded_count = 0
212
+
213
while True:
214
resp = self._get(
215
path=path,
@@ -226,8 +229,11 @@ def _paginate_iter(
226
229
if result_key not in decoded:
227
230
return []
228
231
for t in decoded[result_key]:
232
+ if limit is not None and yielded_count >= limit:
233
+ return
234
yield deserializer(t)
- if "next_url" in decoded:
235
+ yielded_count += 1
236
+ if "next_url" in decoded and (limit is None or yielded_count < limit):
237
path = decoded["next_url"].replace(self.BASE, "")
238
params = {}
239
else:
0 commit comments