Skip to content

Commit

Permalink
Fix total pages not being on any return call.
Browse files Browse the repository at this point in the history
  • Loading branch information
Knucklessg1 committed Aug 7, 2024
1 parent 5110c7c commit 00b1d74
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions gitlab_api/gitlab_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,7 @@ def get_merge_requests(self, **kwargs) -> Union[Response, requests.Response]:
headers=self.headers,
verify=self.verify,
)
total_pages = int(response.headers["X-Total-Pages"])
total_pages = int(response.headers.get("X-Total-Pages", 1))
response = []
if merge_request.max_pages == 0 or merge_request.max_pages > total_pages:
merge_request.max_pages = total_pages
Expand Down Expand Up @@ -2174,7 +2174,7 @@ def get_nested_projects_by_group(
pages_response = self.get_total_projects_in_group(
group_id=project.group_id, per_page=project.per_page
)
total_pages = int(pages_response.headers["X-Total-Pages"])
total_pages = int(pages_response.headers.get("X-Total-Pages", 1))
if (
not project.max_pages
or project.max_pages == 0
Expand Down
4 changes: 1 addition & 3 deletions gitlab_api/gitlab_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3413,9 +3413,7 @@ class Meta:
billable_members_count: Optional[int] = Field(
default=None, description="The Billable members count of the namespace, if any."
)
plan: Optional[str] = Field(
default=None, description="Plan of the Namespace"
)
plan: Optional[str] = Field(default=None, description="Plan of the Namespace")
trial_ends_on: Optional[datetime] = Field(
default=None, description="The date the Trial ends"
)
Expand Down

0 comments on commit 00b1d74

Please sign in to comment.