# Orders data using Python

**URL:** <https://community.shopify.com/t/orders-data-using-python/158888>\
**Category:** Custom Storefronts\
**Created:** [October 11, 2022, 2:09pm UTC](https://community.shopify.com/t/orders-data-using-python/158888 "2022-10-11T14:09:35Z")\
**Posts on this page:** 2\
**Page:** 1

## AI-generated summary

Issue: Fetching Shopify order data via Python from a private store to later manipulate by date.

- Approach: Uses a loop with since_id pagination, limit=250, and fulfillment_status=unfulfilled; builds a DataFrame from response.json()['Order'] and concatenates pages.
- Error: KeyError: 'Order' occurs when accessing the JSON response, indicating the expected 'Order' key isn’t present in the returned data structure.

Context: The error prevents extraction of orders and subsequent date-based operations.

Outcome: The original poster confirmed the issue was resolved (“Got it Thank you”). No specific fix or changes were documented.

Status: Resolved, with no further action items or open questions shared.

<div class="post-metadata">

**Author:** ![vedant\_revact](https://avatars.discourse-cdn.com/v4/letter/v/7c8e57/32.png) [@vedant\_revact](https://community.shopify.com/u/vedant_revact)\
**Post date:** [October 11, 2022, 2:09pm UTC](https://community.shopify.com/t/orders-data-using-python/158888/1 "2022-10-11T14:09:35Z")

</div>

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 = [email removed]  
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()

```auto
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.

---

<div class="post-metadata">

**Author:** ![vedant\_revact](https://avatars.discourse-cdn.com/v4/letter/v/7c8e57/32.png) [@vedant\_revact](https://community.shopify.com/u/vedant_revact)\
**Post date:** [October 11, 2022, 2:54pm UTC](https://community.shopify.com/t/orders-data-using-python/158888/2 "2022-10-11T14:54:48Z")

</div>

Got it Thank you
