Orders data using Python

Orders data using Python

vedant_revact
Visitor
2 0 0

I am trying to get ORDER data from shopify. I have created a private store, I have the api credentials in my code but, 

 

def get_all_orders():
last=0
orders=pd.DataFrame()
while True:
url = f"https://{apikey}:{password}@{hostname}/admin/api/{version}/{resource}.jsonlimit=250&fulfillment_status=unfulfilled&since_id={last}"
response = requests.request("GET", url)

df=pd.DataFrame(response.json()['Order'])
orders=pd.concat([orders,df])
last=df['id'].iloc[-1]
if len(df)<=250:
break
return(orders)

 

df=get_all_orders()
df.head()

 

KeyError: 'Order'

I want to extract data by manipulating 'date' but it seems like the code is unable to fetch 'order' attribute from the store. Need Help! Thanks.

Reply 1 (1)

vedant_revact
Visitor
2 0 0

Got it Thank you