kopia lustrzana https://github.com/halcy/Mastodon.py
fetch_next and fetch_previous shouldn't crash on last page
When `fetch_next` reaches the last page, the `_pagination_next` attribute exists in the page structure but is set to None; similarly for `_pagination_prev` in `fetch_previous`. If this occurs we need to return `None` rather than trying to interate over `None` and generating an exception.pull/397/head
rodzic
b16b811ef5
commit
74eb57203b
|
@ -134,6 +134,9 @@ class Mastodon(Internals):
|
|||
else:
|
||||
params = copy.deepcopy(previous_page)
|
||||
|
||||
if params is None:
|
||||
return None
|
||||
|
||||
is_pagination_dict = False
|
||||
if isinstance(previous_page, dict):
|
||||
if all(key in ['_pagination_method', '_pagination_endpoint', 'min_id', 'max_id', 'since_id', 'limit'] for key in previous_page):
|
||||
|
@ -173,6 +176,9 @@ class Mastodon(Internals):
|
|||
else:
|
||||
params = copy.deepcopy(next_page)
|
||||
|
||||
if params is None:
|
||||
return None
|
||||
|
||||
is_pagination_dict = False
|
||||
if isinstance(next_page, dict):
|
||||
if all(key in ['_pagination_method', '_pagination_endpoint', 'min_id', 'max_id', 'since_id', 'limit'] for key in next_page):
|
||||
|
|
Ładowanie…
Reference in New Issue