Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix logic to continue with the current_page
Browse files Browse the repository at this point in the history
Krystle Salazar committed Mar 27, 2023

Unverified

No user is associated with the committer email.
1 parent 2873b50 commit 9a0cad9
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ class PhylopicDataIngester(ProviderDataIngester):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.current_page = 0
self.current_page = 1
self.total_pages = 0
self.build_param = 0

@@ -46,7 +46,7 @@ def _get_initial_query_params(self) -> None:
self.total_pages = resp.get("totalPages")
logger.info(
f"Total items to fetch: {resp.get('totalItems')}. "
f"Total pages: {self.total_pages}"
f"Total pages: {self.total_pages}."
)

def get_next_query_params(self, prev_query_params: dict | None, **kwargs) -> dict:
@@ -55,11 +55,12 @@ def get_next_query_params(self, prev_query_params: dict | None, **kwargs) -> dic

return {
"build": self.build_param,
"page": self.current_page,
"page": self.current_page - 1, # PhyloPic pages are 0-indexed.
"embed_items": "true",
}

def get_should_continue(self, response_json):
logger.debug(f"Processing page {self.current_page} of {self.total_pages}.")
return self.current_page < self.total_pages

def get_batch_data(self, response_json):

0 comments on commit 9a0cad9

Please sign in to comment.