Skip to content

Commit

Permalink
Add option disabling results limit to API methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasfreimuth committed Oct 9, 2023
1 parent b6f844c commit 1775a3e
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions easy_entrez/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,17 @@ def _request(self, query: EntrezQuery, custom_payload=None) -> EntrezResponse:
@uses_query(SearchQuery)
def search(
self, term: Union[str, dict], max_results: int,
database: EntrezDatabase = 'pubmed', min_date=None, max_date=None
database: EntrezDatabase = 'pubmed', min_date=None, max_date=None,
ignore_max_results_limit: bool = False
):
if isinstance(term, dict):
term = _match_all(**term)

assert not min_date and not max_date # TODO
query = SearchQuery(term=term, max_results=max_results, database=database)
query = SearchQuery(
term=term, max_results=max_results, database=database,
ignore_max_results_limit=ignore_max_results_limit
)
return self._request(query=query)

def in_batches_of(self, size: int = 100, sleep_interval: int = 3):
Expand All @@ -161,20 +165,27 @@ def in_batches_of(self, size: int = 100, sleep_interval: int = 3):
@uses_query(SummaryQuery)
def summarize(
self, ids: List[str], max_results: int,
database: EntrezDatabase = 'pubmed'
database: EntrezDatabase = 'pubmed', ignore_max_results_limit: bool = False
):
self._ensure_list_like(ids)
query = SummaryQuery(ids=ids, max_results=max_results, database=database)
query = SummaryQuery(
ids=ids, max_results=max_results, database=database,
ignore_max_results_limit=ignore_max_results_limit
)
return self._request(query=query)

@supports_batches
@uses_query(FetchQuery)
def fetch(
self, ids: List[str], max_results: int,
database: EntrezDatabase = 'pubmed', return_type: ReturnType = 'xml'
database: EntrezDatabase = 'pubmed', return_type: ReturnType = 'xml',
ignore_max_results_limit: bool = False
):
self._ensure_list_like(ids)
query = FetchQuery(ids=ids, max_results=max_results, database=database, return_type=return_type)
query = FetchQuery(
ids=ids, max_results=max_results, database=database,
return_type=return_type, ignore_max_results_limit=ignore_max_results_limit
)
return self._request(query=query)

@supports_batches
Expand Down

0 comments on commit 1775a3e

Please sign in to comment.