Skip to content

Commit

Permalink
Merge pull request #15 from bothub-it/fix_pagination
Browse files Browse the repository at this point in the history
fix pagination
  • Loading branch information
mldzs committed Mar 5, 2021
2 parents 4f3b5bb + f9e0de2 commit b57e32a
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions bothub_backend/bothub.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,24 @@ def request_backend_save_queue_id(self, update_id, repository_authorization, tas
return response

@print_execution_time
def request_backend_get_examples(self, update_id, repository_authorization=None, intent=""):
url = f"{self.backend}/v2/repository/nlp/authorization/train/get_examples/"
query_params = {
"repository_version": update_id,
"intent": intent
}
headers = {
"Authorization": f"Bearer {repository_authorization}"
}
response = requests.get(url, params=query_params, headers=headers).json()
def request_backend_get_examples(self,
update_id,
page=None,
repository_authorization=None,
intent="",
):
headers = {
"Authorization": f"Bearer {repository_authorization}"
}
if page:
response = requests.get(page, headers=headers).json()
else:
url = f"{self.backend}/v2/repository/nlp/authorization/train/get_examples/"
query_params = {
"repository_version": update_id,
"intent": intent
}
response = requests.get(url, params=query_params, headers=headers).json()

return response

Expand Down

0 comments on commit b57e32a

Please sign in to comment.