(bugfix) interation of paginated content does not crash anymore when iterating into an empty page answered by an error by gitea

pull/15/head
Langenfeld 2022-09-07 10:50:54 +02:00
rodzic fe120be112
commit b7c9e9ab80
2 zmienionych plików z 3 dodań i 5 usunięć

Wyświetl plik

@ -79,8 +79,6 @@ class Gitea:
if sudo:
combined_params["sudo"] = sudo.username
request = self.requests.get(self.__get_url(endpoint), headers=self.headers, params=combined_params)
if request.status_code == 204:
return None
if request.status_code not in [200, 201]:
message = f"Received status code: {request.status_code} ({request.url})"
if request.status_code in [404]:
@ -100,10 +98,10 @@ class Gitea:
while True:
combined_params[page_key] = page
result = self.requests_get(endpoint, combined_params, sudo)
if not result:
return aggregated_result
aggregated_result.extend(result)
page += 1
if len(result) == 0:
return aggregated_result
def requests_put(self, endpoint: str):
request = self.requests.put(self.__get_url(endpoint), headers=self.headers)

Wyświetl plik

@ -5,7 +5,7 @@ with open('README.md') as readme_file:
setup_args = dict(
name='py-gitea',
version='0.2.2',
version='0.2.3',
description='A python wrapper for the Gitea API',
long_description_content_type="text/markdown",
long_description=README,