From ca80776dd108f74acecbe3937b981c3866ba15af Mon Sep 17 00:00:00 2001 From: GeoJulien Date: Sat, 9 Mar 2024 22:58:14 +0100 Subject: [PATCH] fix: Mastodon export was only exporting first page --- geotribu_cli/social/mastodon_client.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/geotribu_cli/social/mastodon_client.py b/geotribu_cli/social/mastodon_client.py index 7fe60b4..4a55672 100644 --- a/geotribu_cli/social/mastodon_client.py +++ b/geotribu_cli/social/mastodon_client.py @@ -16,8 +16,6 @@ from urllib import request from urllib.parse import urlparse -# 3rd party -from mastodon import Mastodon, MastodonAPIError, MastodonError from requests import Session from rich import print @@ -27,6 +25,9 @@ from geotribu_cli.constants import GeotribuDefaults from geotribu_cli.utils.proxies import get_proxy_settings +# 3rd party +from mastodon import Mastodon, MastodonAPIError, MastodonError + # ############################################################################ # ########## GLOBALS ############# # ################################ @@ -236,7 +237,9 @@ def export_data( if dest_path_lists is not None or dest_path_lists_only_accounts is not None: try: dico_listes = { - liste.get("title"): self.list_accounts(id=liste.get("id")) + liste.get("title"): self.fetch_remaining( + self.list_accounts(id=liste.get("id")) + ) for liste in self.lists() } except Exception as err: @@ -249,7 +252,9 @@ def export_data( # récupération des comptes suivis if dest_path_following_accounts is not None: try: - masto_following_accounts = self.account_following(id=self.me()) + masto_following_accounts = self.fetch_remaining( + self.account_following(id=self.me()) + ) except Exception as err: logger.critical( "La récupération des comptes suivis a échoué. L'export est "