How to paginated requests with python request in shopify?

I am using the following code to get orders within the range of dates I have specified.

import shopify
import requests
import pandas as pd
key = 'key'
secret='secret'
shopify.Session.setup(api_key=key, secret=secret)
final=pd.DataFrame()

url="https://key:secret@mystore.myshopify.com/admin/api/2021-10/orders.json"
params={'created_at_min':'2021-12-15 21:00:00',
       'created_at_max':'2021-12-16 20:59:59',
       'limit':'70'}
r = requests.get(url=url,params=params)
a=r.json()
df=pd.DataFrame(a['orders'])

But I couldn’t figure out how to get the data from the next page. shopify is not returning any response header.

I can get max 250 orders in a single query. But how do I do this if I need to receive more than 250 orders ? Also, how to do it is explained here, but I couldn’t do it.

Hey Nazesh,

I am having a similar issue, I am just slightly farther along! Shopify is attaching a header. It is attached to the response. It just appears to be hidden. Insert the line “print(r.headers)” right after the line where you make the request. The header is rather long. And as stated in the documentation you hyper linked to, the header will not contain another link if there is no data to provide!