You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by GitBox <gi...@apache.org> on 2022/03/02 21:30:06 UTC

[GitHub] [libcloud] Kami commented on a change in pull request #1655: Add paginated request method to GCEConnection

Kami commented on a change in pull request #1655:
URL: https://github.com/apache/libcloud/pull/1655#discussion_r818118924



##########
File path: libcloud/compute/drivers/gce.py
##########
@@ -224,14 +243,13 @@ def _merge_response_items(self, list_name, response_list):
         """
         merged_items = {}
         for resp in response_list:
-            if "items" in resp:
-                # example k would be a zone or region name
-                # example v would be { "disks" : [], "otherkey" : "..." }
-                for k, v in resp["items"].items():
-                    if list_name in v:
-                        merged_items.setdefault(k, {}).setdefault(list_name, [])
-                        # Combine the list with the existing list.
-                        merged_items[k][list_name] += v[list_name]
+            # example k would be a zone or region name
+            # example v would be { "disks" : [], "otherkey" : "..." }
+            for k, v in resp["items"].items():

Review comment:
       I see you removed `if "items" in resp`, after merging that PR, I will make the following change (`for k, v in resp.get("items", {}).items()`) to be on the safe side (in case some response for some reason doesn't contains `items` attribute - probably quite unlikely, but just to be on the safe side).




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@libcloud.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org