Skip to content

Commit 01b03d0

Browse files
committed
tweak pagination
1 parent 7fafb65 commit 01b03d0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

intbot/core/integrations/pretalx.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,12 @@ def fetch_pretalx_data(
4646
# Pretalx paginates the output, so we will need to do multiple requests and
4747
# then merge multiple pages to one big dictionary
4848
results = []
49-
data = {"next": url}
5049
page = 0
5150

52-
# This takes advantage of the fact that "next" will contain a url to the
51+
# This takes advantage of the fact that url will contain a url to the
5352
# next page, until there is more data to fetch. If this is the last page,
54-
# then the data["next"] will be None (falsy), and thus stop the while loop.
55-
while url := data["next"]:
53+
# then the url will be None (falsy), and thus stop the while loop.
54+
while url:
5655
page += 1
5756
response = httpx.get(url, headers=headers)
5857

@@ -64,6 +63,7 @@ def fetch_pretalx_data(
6463

6564
data = response.json()
6665
results += data["results"]
66+
url = data["next"]
6767

6868
return results
6969

0 commit comments

Comments
 (0)