Skip to content

Instantly share code, notes, and snippets.

@patdevinwilson
Last active August 24, 2020 21:56
Show Gist options
  • Save patdevinwilson/2b8705e86abfeb4b0b6d77dd85caf414 to your computer and use it in GitHub Desktop.
Save patdevinwilson/2b8705e86abfeb4b0b6d77dd85caf414 to your computer and use it in GitHub Desktop.
Looks up a list of inline photo IDs from a CSV file and downloads photos from Fulcrum API
import csv
from fulcrum import Fulcrum
from fulcrum.exceptions import NotFoundException
api_key = '[API KEY]'
fulcrum = Fulcrum(key=api_key)
photos_list = csv.reader(open('photos.csv'), delimiter=',')
for row in photos_list:
# fetch existing record (first column must contain fulcrum_id)
try:
photo = fulcrum.photos.media(row[0])
except NotFoundException:
print('^/ ' + row[0])
continue
with open(row[0]+'.jpg'.format(id), 'wb') as f:
f.write(photo)
print('Downloaded' row[0]+'.jpg'.format(id))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment