michalslowikowski00 commented on a change in pull request #7743: [AIRFLOW-7075] 
Operators for storing information from GCS into GA
URL: https://github.com/apache/airflow/pull/7743#discussion_r396953661
 
 

 ##########
 File path: airflow/providers/google/marketing_platform/hooks/analytics.py
 ##########
 @@ -59,19 +75,9 @@ def list_accounts(self) -> List[Dict[str, Any]]:
         """
 
         self.log.info("Retrieving accounts list...")
-        result = []  # type: List[Dict]
         conn = self.get_conn()
         accounts = conn.management().accounts()  # pylint: disable=no-member
-        while True:
-            # start index has value 1
-            request = accounts.list(start_index=len(result) + 1)
-            response = request.execute(num_retries=self.num_retries)
-            result.extend(response.get("items", []))
-            # result is the number of fetched accounts from Analytics
-            # when all accounts will be add to the result
-            # the loop will be break
-            if response["totalResults"] <= len(result):
-                break
+        result = self._paginate(accounts)
 
 Review comment:
   Wow... brilliant.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to