Skip to content

Instantly share code, notes, and snippets.

@benlansdell
Last active March 1, 2017 19:46
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 benlansdell/a66bc54ca0b23a0ecf0c2ace4b92d83a to your computer and use it in GitHub Desktop.
Save benlansdell/a66bc54ca0b23a0ecf0c2ace4b92d83a to your computer and use it in GitHub Desktop.
Upload files to Zenodo
headers = {"Content-Type": "application/json"}
r = requests.post("https://zenodo.org/api/deposit/depositions?access_token=ACCESS", data="{}", headers=headers)
deposition_id = r.json()['id']
l = len(nevfiles)
#for idx,nv in enumerate(nevfiles):
for idx in range(31,len(nevfiles)):
nv = nevfiles[idx]
print("Depositing %d/%d: %s"%(idx+1,l,nv))
data = {'filename': nv}
files = {'file': open(nv, 'rb')}
r = requests.post("https://zenodo.org/api/deposit/depositions/%s/files?access_token=ACCESS" % deposition_id, data=data, files=files)
if r.status_code == 400:
print("HTTP bad request, exiting")
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment