我必须使用标准shopify API (python)进行此调用
https://store.myshopify.com/admin/shop.json
我得到的是:
ipdb> shopify.Shop.current()
shop(2330215)
但:
ipdb> shopify.Shop.get(2330215)
*** ResourceNotFound: Not Found:https://store.myshopify.com/admin/shops/2330215.xml
ipdb>
据我所知,根本没有/admin/shops
(复数)API路径。
你使用API per shop, shop_url
参数让你访问一个特定的商店,然后你不能访问其他商店,也不需要使用shopify.Shop.get()
。
Python库对所有资源类型使用泛型基类,这就是.get()
方法的来源,但是该方法对商店没有意义。
shopify.Shop.current()
返回您需要关心的一个商店资源。它有一个.attributes
属性,保存Shopify API返回的所有数据;该映射中的键也可以作为主资源对象的属性:
shop = shopify.Shop.current()
print shop.attributes.keys()
print shop.name