#packages to perform the request, handle JSON objects, and encode URLs
session = requests.Session()
#API KEY as defined in the settings tab, so that the script has full access to the data
#base endpoint, see https://bubble.io/reference#API.get_api.Endpoint
base_url = 'https://yourapp.com/api/1.1/obj/invoice'
#Query initial parameters. We do not send a limit parameter (default is 100)
#we keep making calls till we have no remaining items to fetch
#data we send with the search. Search constraints would be here
params = {'cursor': cursor, 'api_token': API_KEY}
url = base_url + '?' + urllib.parse.urlencode(params)
response = session.get(url)
if response.status_code != 200:
print('Error with status code {}'.format(response.status_code))
chunk = response.json()['response']
remaining = chunk['remaining']
results = chunk['results']
print(json.dumps(result, indent=4, sort_keys=True))