[英]How to get all the orders in shopify with fulfillment status as shipped using REST API in python?
I am trying to get all the orders on a shopify store which have the fulfillment status as shipped.我正在尝试获取 Shopify 商店中的所有订单,这些订单的履行状态为已发货。
When I use the following in the web browser url, I am able to get the desired results:当我在 Web 浏览器 url 中使用以下内容时,我能够获得所需的结果:
https://<store_name>.myshopify.com/admin/api/2020-01/orders/search.json?query=fulfillment_status:shipped
However, when I try to use the following piece of python (Python 3.8.2) code, the json returned is empty.但是,当我尝试使用以下 Python(Python 3.8.2)代码时,返回的 json 为空。 What am I missing?
我错过了什么?
>>> payload = {'fulfillment_status':'shipped', 'limit':100}
>>> response = requests.get( "https://%s.myshopify.com/admin/api/2020-01/orders.json" % (SHOP_NAME), auth=(API_KEY,PASSWORD), params=payload)
>>> response
<Response [200]>
>>> response.json()
{'orders': []}
Try by using the following URL:尝试使用以下 URL:
url = "https://{apikey}:{password}@{hostname}/admin/api/{version}/{resource}.json?limit=250&fulfillment_status=shipped"
response = requests.request("GET", url)
There is a tutorial on how you can get all orders from Shopify, you may find it useful:有一个关于如何从 Shopify 获取所有订单的教程,您可能会发现它很有用:
https://predictivehacks.com/how-to-get-all-orders-from-shopify-in-python/ https://predictivehacks.com/how-to-get-all-orders-from-shopify-in-python/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.