Skip to content

Commit

Permalink
Fixed secondary methods.
Browse files Browse the repository at this point in the history
Changed secondary information methods to ensure that the page data is passed correctly.
  • Loading branch information
ejedev authored Feb 21, 2020
1 parent 36a5e26 commit 45bfe20
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Unleashed/Unleashed.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ def _get_request(self, method, params=None):

def request_endpoint(self, endpoint, options=None, page=None):
if options is not None and page is not None:
resp = self._get_request(endpoint + "/" + page + "/" + "?" + options)
resp = self._get_request(endpoint + "/" + str(page) + "/" + "?" + options)
elif options is not None and page is None:
resp = self._get_request(endpoint + "?" + options)
elif options is None and page is not None:
resp = self._get_request(endpoint + "/" + page + "/")
resp = self._get_request(endpoint + "/" + str(page) + "/")
else:
resp = self._get_request(endpoint)
json_parsed = resp.json()
return json_parsed

def return_items(self, endpoint ,options=None):
return self.request_endpoint(endpoint,options)['Items']
def return_items(self, endpoint ,options=None, page=None):
return self.request_endpoint(endpoint,options,page)['Items']

def return_pagination(self, endpoint ,options=None):
return self.request_endpoint(endpoint,options)['Pagination']
def return_pagination(self, endpoint ,options=None,page=None):
return self.request_endpoint(endpoint,options,page)['Pagination']

0 comments on commit 45bfe20

Please sign in to comment.