You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def get_data(self, endpoint, max_recs=None, offset=0):
"""
get data from a given endpoint
this simplifies the looping process that would otherwise be repeated
:param str endpoint: endpoint to be appended to bulk_base
:param int max_recs: Max number of records to return
"""
url_base = self.bulk_base + endpoint + '?limit={limit}&offset={offset}'
limit, has_more = self._set_limit(max_recs, 0, True)
return_data = []
cant_rows = 1
while has_more and cant_rows>0:
url = url_base.format(limit=limit, offset=offset)
req = requests.get(url=url, auth=self.auth)
_elq_error_(req)
if 'items' in req.json().keys():
return_data.extend(req.json()['items'])
cant_rows=len(req.json()['items'])
else:
cant_rows = 0
offset += 1000
if max_recs is None:
has_more = req.json()['hasMore']
limit, has_more = self._set_limit(max_recs, len(return_data),
req.json()['hasMore'])
return return_data
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: