caltechlibrary/caltechdata_api

Error trying to use example notebook to upload data

Closed this issue · 3 comments

Hello I'm having trouble getting the example notebook to work, I updated to the latest version of the API.

I'm trying to use the example below. Also, I couldn't find documentation on the arguments the function caltechdata_write. I even looked at the source code but it didn't have many comments so I'm kinda lost

from caltechdata_api import download_file, caltechdata_write
import json
#Now write a file to CaltechDATA test instance (cd-sandbox.tind.io)

token = 'TOKEN'

metaf = open('example43.json', 'r')
metadata = json.load(metaf)
filen = 'logo.gif'

production = False

response = caltechdata_write(metadata, token, filen, production, schema='43')
print(response)

image

What’s the size of the file? We might have to switch out the upload method

2GB

Oh, you need to use a real token instead of the placeholder TOKEN value. You can get a CaltechDATA token by following the instructions at https://libanswers.caltech.edu/faq/211307

I've added an exception to make this a bit clearer, but I still need to do some improvements to the S3 upload #3