Skip to content

Instantly share code, notes, and snippets.

@qetzal
Created August 14, 2013 13:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qetzal/6231159 to your computer and use it in GitHub Desktop.
Save qetzal/6231159 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/python
import requests, sys, json
store_id = sys.argv[1]
r = requests.get('https://app.ecwid.com/api/v1/' + store_id + '/products')
products = r.json()
for product in products:
p = requests.get('https://app.ecwid.com/api/v1/' + store_id + '/product?id=' + str(product["id"]))
pitem = p.json()
image_url = pitem["originalImageUrl"]
image_request = requests.get(image_url)
f = open(str(pitem["id"]) + ".jpg", 'w+')
f.write(image_request.content)
f.close
print str(pitem["id"]) + "\n"
print "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment