I basically have a problem with how the Shopify URL is stored and what I have to write to access it. I'm not a python expert, so it might be something simple that I don't see.
Shopify has an API that allows application developers to access products, orders, etc. from the store. I can get a list of all the products in my store and get information such as name and price, but Iβm having problems capturing the image. Here is the basic code of what is happening and what I need:
import shopify
I believe that each product has a list of images. What I want to do is create a list of URLs of the image source as strings for each product. Looking at Buy API documentation for a product , I see that the product.images attribute is as follows:
{ "images" : "[ { "src": "http://example.com/burton.jpg" } ]"}
And when I do pdb.set_trace () on product.images , it looks like this (I changed the numbers for privacy):
[image(12345678), image(12345678), image(12345678), image(12345678)]
When I do dir () on one of the images, I get the following:
['_ShopifyResource__get_id', '_ShopifyResource__set_id', '_ShopifyResource__to_xml_element', '__class__', '__cmp__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattr__', '__getattribute__', '__hash__', '__init__', '__metaclass__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_build_list', '_build_object', '_class_delete', '_class_get', '_class_head', '_class_post', '_class_put', '_collection_path', '_connection', '_custom_method_collection_url', '_custom_method_element_url', '_custom_method_new_element_url', '_element_path', '_find_class_for', '_find_class_for_collection', '_find_every', '_find_one', '_find_single', '_format', '_headers', '_id_from_response', '_initialized', '_instance_delete', '_instance_get', '_instance_head', '_instance_post', '_instance_put', '_load_attributes_from_response', '_password', '_plural', '_prefix', '_prefix_options', '_prefix_parameters', '_prefix_source', '_primary_key', '_query_string', '_singular', '_site', '_split_options', '_threadlocal', '_timeout', '_update', '_user', 'activate_session', 'attach_image', 'attributes', 'clear_session', 'count', 'create', 'delete', 'destroy', 'errors', 'exists', 'find', 'find_first', 'find_one', 'get', 'get_id', 'head', 'id', 'is_new', 'is_valid', 'klass', 'post', 'put', 'reload', 'save', 'set_id', 'to_dict', 'to_xml']
EDIT:
Using the Pawelmhm help, the resulting code to access the source URL is:
products = shopify.Product.find()