skillcorner 2.2.7__tar.gz → 2.2.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -124,12 +124,12 @@ class SkillcornerClient(FitRequest):
|
|
|
124
124
|
_methods_binding = METHODS_BINDING
|
|
125
125
|
|
|
126
126
|
@staticmethod
|
|
127
|
-
def
|
|
128
|
-
return not isinstance(response, dict) or not response
|
|
127
|
+
def _is_response_paginated(response: Union[bytes, dict, str, Element]) -> bool:
|
|
128
|
+
return not isinstance(response, dict) or 'next' not in response
|
|
129
129
|
|
|
130
130
|
def _paginate_and_return(self, method: RequestMethod, response: dict, raise_for_status: bool = True) -> dict:
|
|
131
131
|
results = response['results']
|
|
132
|
-
while not self.
|
|
132
|
+
while not self._is_response_paginated(response) and response.get('next'):
|
|
133
133
|
response = self._handle_response(
|
|
134
134
|
self.session.request(
|
|
135
135
|
method=method.value,
|
|
@@ -148,6 +148,6 @@ class SkillcornerClient(FitRequest):
|
|
|
148
148
|
**kwargs,
|
|
149
149
|
) -> Union[bytes, dict, str, Element]:
|
|
150
150
|
response = super()._request(method=method, endpoint=endpoint, raise_for_status=raise_for_status, **kwargs)
|
|
151
|
-
if self.
|
|
151
|
+
if self._is_response_paginated(response):
|
|
152
152
|
return response
|
|
153
153
|
return self._paginate_and_return(method, response, raise_for_status)
|
|
File without changes
|
|
File without changes
|