Skip to content

Commit

Permalink
Add option to return only the text of a Biosample query (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcezard authored Aug 6, 2024
1 parent 4b6cee3 commit 90e61c5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ebi_eva_common_pyutils/biosamples_communicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,15 @@ def follows(self, query, json_obj=None, method='GET', url_template_values=None,
url = re.sub('{(' + k + ')(:.*)?}', v, url)
if join_url:
url += '/' + join_url
text_only = False
if 'text_only' in kwargs and kwargs.get('text_only'):
text_only = kwargs.pop('text_only')
# Now query the url
json_response = self._req(method, url, **kwargs).json()
response = self._req(method, url, **kwargs)
if text_only:
return response.text

json_response = response.json()
# Depaginate the call if requested
if all_pages is True:
# This depagination code will iterate over all the pages available until the pages comes back without a
Expand Down

0 comments on commit 90e61c5

Please sign in to comment.