0

我正在尝试使用 Shopify 的 python API 来检索产品图像列表,但出现错误。我认为这是因为网址格式错误。有什么解决办法吗?

images = shopify.Image.find(product.id)

错误堆栈跟踪:

Traceback:
File "/home/rodxavierbondoc/.virtualenvs/shopify/src/django/django/core/handlers/base.py" in get_response
  105.                         response = middleware_method(request, callback, callback_args, callback_kwargs)
File "/home/rodxavierbondoc/.virtualenvs/shopify/local/lib/python2.7/site-packages/mezzanine/pages/middleware.py" in process_view
  45.             return view_func(request, *view_args, **view_kwargs)
File "/home/rodxavierbondoc/.virtualenvs/shopify/src/django/django/views/generic/base.py" in view
  48.             return self.dispatch(request, *args, **kwargs)
File "/home/rodxavierbondoc/.virtualenvs/shopify/src/django/django/utils/decorators.py" in _wrapper
  25.             return bound_func(*args, **kwargs)
File "/home/rodxavierbondoc/.virtualenvs/shopify/src/django/django/contrib/auth/decorators.py" in _wrapped_view
  20.                 return view_func(request, *args, **kwargs)
File "/home/rodxavierbondoc/.virtualenvs/shopify/src/django/django/utils/decorators.py" in bound_func
  21.                 return func(self, *args2, **kwargs2)
File "/home/rodxavierbondoc/.virtualenvs/shopify/src/django/django/utils/decorators.py" in _wrapper
  25.             return bound_func(*args, **kwargs)
File "/home/rodxavierbondoc/workspace/sg/djangoproject/shopify_app/decorators.py" in wrapper
  10.         return func(request, *args, **kwargs)
File "/home/rodxavierbondoc/.virtualenvs/shopify/src/django/django/utils/decorators.py" in bound_func
  21.                 return func(self, *args2, **kwargs2)
File "/home/rodxavierbondoc/workspace/sg/djangoproject/shopify_galleries/views.py" in dispatch
  93.         return super(ListProductsView, self).dispatch(request, *args, **kwargs)
File "/home/rodxavierbondoc/.virtualenvs/shopify/src/django/django/views/generic/base.py" in dispatch
  69.         return handler(request, *args, **kwargs)
File "/home/rodxavierbondoc/.virtualenvs/shopify/src/django/django/views/generic/list.py" in get
  114.         self.object_list = self.get_queryset()
File "/home/rodxavierbondoc/workspace/sg/djangoproject/shopify_galleries/views.py" in get_queryset
  100.             image = shopify.Image.find(product.id)
File "/home/rodxavierbondoc/.virtualenvs/shopify/local/lib/python2.7/site-packages/pyactiveresource/activeresource.py" in find
  349.             return cls._find_single(id_, **kwargs)
File "/home/rodxavierbondoc/.virtualenvs/shopify/local/lib/python2.7/site-packages/pyactiveresource/activeresource.py" in _find_single
  452.         return cls._build_object(cls.connection.get(path, cls.headers),
File "/home/rodxavierbondoc/.virtualenvs/shopify/local/lib/python2.7/site-packages/pyactiveresource/connection.py" in get
  328.         return self.format.decode(self._open('GET', path, headers=headers).body)
File "/home/rodxavierbondoc/.virtualenvs/shopify/local/lib/python2.7/site-packages/shopify/base.py" in _open
  18.             self.response = super(ShopifyConnection, self)._open(*args, **kwargs)
File "/home/rodxavierbondoc/.virtualenvs/shopify/local/lib/python2.7/site-packages/pyactiveresource/connection.py" in _open
  287.                 http_response = self._handle_error(err)
File "/home/rodxavierbondoc/.virtualenvs/shopify/local/lib/python2.7/site-packages/pyactiveresource/connection.py" in _handle_error
  407.             raise ResourceNotFound(err)

Exception Type: ResourceNotFound at /galleries/1/products/
Exception Value: Not Found: https://sawayn-and-sons9677.myshopify.com/admin/products//images/103786527.xml
4

1 回答 1

4

product_idProduct Images API 中的 是一个前缀选项,它是使用关键字参数指定的。

images = shopify.Image.find(product_id=product.id)

于 2012-09-27T15:52:40.210 回答