Skip to content

Instantly share code, notes, and snippets.

Last active February 10, 2019 13:27
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cjohannsen81/bd4204a3461164e2d99ad38775f55abb to your computer and use it in GitHub Desktop.
import requests
import csv
#Login using: curl -i -d '{"login_id":"EMAIL","password":"PASSWORD"}'
#Copy the token
auth_token = raw_input("Please enter your auth token: ")
posts = raw_input("Please enter the filename to parse: ")
hed = {'Authorization': 'Bearer ' + auth_token}
def read_csv():
reader_m = csv.reader(open(posts),delimiter=',')
for row_m in reader_m:
if len(row_m[19]) > 11:
fileid = row_m[19]
id = fileid[2:28]
def get_file(id):
info_url = '' + id + '/info'
response = requests.get(info_url, headers=hed)
info = response.json()
filename = info["name"]
file_url = '' + id
response = requests.get(file_url, headers=hed)
open(filename, 'wb').write(response.content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment