Skip to content

Instantly share code, notes, and snippets.

@nicolas-modsy
Created May 16, 2018 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicolas-modsy/b1dcd12dba000fcd7f36f4f53032e099 to your computer and use it in GitHub Desktop.
Save nicolas-modsy/b1dcd12dba000fcd7f36f4f53032e099 to your computer and use it in GitHub Desktop.
The marketing team wanted to download some images... EP-4246
import csv
import urllib
# urllib.urlretrieve("http://www.gunnerkrigg.com//comics/00000001.jpg", "00000001.jpg")
# export as CSV from Google Sheets
# the header will be commented out, remove the '#' manually
dl_dir = '/Users/nicolasrichard/Desktop/ImagePull1/'
modsy_prod_bucket_url = 'https://s3.us-west-2.amazonaws.com/modsy/'
# styleboard_id,variation_number,camera_id,url,styleResult
with open('/Users/nicolasrichard/Downloads/Image Pull - Data.csv') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
img_outname = row['styleResult'] + '__' + row['styleboard_id'] + '_' + row['variation_number'] + '_' + row['camera_id'] + '.jpg'
img_url = modsy_prod_bucket_url + row['url']
print img_url, img_outname
urllib.urlretrieve(img_url, dl_dir + img_outname)
######## bash
"""
cd /Users/nicolasrichard/Desktop/ImagePull1/
mkdir ContemporaryMinimalist
mkdir ModCollector
mkdir ModVisionary
mv ContemporaryMinimalist_* ContemporaryMinimalist
mv ModCollector_* ModCollector
mv ModVisionary_* ModVisionary
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment