嘗試使用python lib創建新的變體。python api - shopify.Variant 404錯誤
創建shopify會議上,我只是嘗試創建一個Variant實例按照該文檔
session = shopify.Session('<My Url>')
session.token = self.provider_access_token
shopify.ShopifyResource.activate_session(session)
v=shopify.Variant(dict(price="20.00", option1="Second"))
v.save()
,並得到後:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/yoda/.virtualenvs/myproject/src/shopify/shopify/base.py", line 151, in save
return super(ShopifyResource, self).save()
File "/Users/yoda/.virtualenvs/myproject/lib/python2.6/site-packages/pyactiveresource /activeresource.py", line 732, in save
data=self.to_xml())
File "/Users/yoda/.virtualenvs/myproject/lib/python2.6/site-packages/pyactiveresource /connection.py", line 313, in post
return self._open('POST', path, headers=headers, data=data)
File "/Users/yoda/.virtualenvs/myproject/src/shopify/shopify/base.py", line 18, in _open
self.response = super(ShopifyConnection, self)._open(*args, **kwargs)
File "/Users/yoda/.virtualenvs/myproject/lib/python2.6/site-packages/pyactiveresource /connection.py", line 258, in _open
response = Response.from_httpresponse(self._handle_error(err))
File "/Users/yoda/.virtualenvs/myproject/lib/python2.6/site-packages/pyactiveresource /connection.py", line 357, in _handle_error
raise ResourceNotFound(err)
ResourceNotFound: HTTP Error 404: Not Found
任何想法或建議嗎? :)
感謝 RCdH
迪倫一起嗨,感謝您的反饋意見。我會給你一個鏡頭..但作爲我嘗試過程的一部分.. p = shopify.Product(xxxxx) p.variants.append(v) 哪個當然沒有工作..所以我手動需要始終指定product_id。將按照指示更新測試,看看會發生什麼:) – stardog101
嗯,這裏是下一個古怪的地方: 嗯似乎是堆棧溢出字符限制的評論..這一點。 – stardog101
V = shopify.Variant(字典(SKU = 'test1的',的product_id = 92048506,價格= 「20.00」)) v.save() – stardog101