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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: skillcorner
3
- Version: 2.2.7
3
+ Version: 2.2.8
4
4
  Summary: Python client for interact with SkillCorner API
5
5
  Home-page: https://skillcorner.com/
6
6
  Author: Skillcorner
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "skillcorner"
3
- version = "2.2.7"
3
+ version = "2.2.8"
4
4
  description = "Python client for interact with SkillCorner API"
5
5
  homepage = "https://skillcorner.com/"
6
6
  repository = "https://gitlab.com/public-corner/skillcorner"
@@ -124,12 +124,12 @@ class SkillcornerClient(FitRequest):
124
124
  _methods_binding = METHODS_BINDING
125
125
 
126
126
  @staticmethod
127
- def _is_response_complete(response: Union[bytes, dict, str, Element]) -> bool:
128
- return not isinstance(response, dict) or not response.get('next')
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._is_response_complete(response):
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._is_response_complete(response):
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