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 c52f236 commit 94e34d2Copy full SHA for 94e34d2
canvasapi/paginated_list.py
@@ -63,14 +63,13 @@ def _get_next_page(self):
63
# See https://github.com/ucfopen/canvasapi/discussions/605
64
if response.links:
65
next_link = response.links.get("next")
66
- elif type(data) is dict and data.get("meta") is not None:
+ elif isinstance(data, dict) and "meta" in data:
67
# requests parses headers into dicts, this returns the same
68
# structure so the regex will still work.
69
- next_link = (
70
- {"url": data.get("meta").get("pagination").get("next"), "rel": "next"}
71
- if data["meta"]["pagination"]["next"]
72
- else None
73
- )
+ try:
+ next_link = {"url": data["meta"]["pagination"]["next"], "rel": "next"}
+ except KeyError:
+ next_link = None
74
else:
75
next_link = None
76
0 commit comments