shotgunsoftware/python-api

Shotgun(connect=False) no longer working as expected

Closed this issue · 2 comments

if connect:
self.server_caps
# Check for api_max_entities_per_page in the server info and change the record per page value if it is supplied.
self.config.records_per_page = self.server_info.get('api_max_entities_per_page') or self.config.records_per_page

Previously, e.g. in v3.0.22, instantiating a Shotgun object did NOT contact the server. Determining the value of records_per_page should be deferred when connect=False.

PS: I'm using that fix for now, working fine so far:

@@ -590,9 +590,6 @@ class Shotgun(object):
         if connect:
             self.server_caps
 
-        # Check for api_max_entities_per_page in the server info and change the record per page value if it is supplied.
-        self.config.records_per_page = self.server_info.get('api_max_entities_per_page') or self.config.records_per_page
-
         # When using auth_token in a 2FA scenario we need to switch to session-based
         # authentication because the auth token will no longer be valid after a first use.
         if self.config.auth_token is not None:
@@ -639,6 +636,11 @@ class Shotgun(object):
             self._server_caps.host != self.config.server):
             self._server_caps = ServerCapabilities(self.config.server,
                 self.info())
+
+            # Check for api_max_entities_per_page in the server info and change the record per page value if it is supplied.
+            self.config.records_per_page = self._server_caps.server_info.get(
+                'api_max_entities_per_page') or self.config.records_per_page
+
         return self._server_caps
 
     def connect(self):

fixed in v3.0.36