def upload_example(): client = BasicAPIClient(DATA_KEY_SECRET_TOKEN) # loading an image into memory data, content_type = client.data_from_file('../images/db_image.jpg') try: item = client.create_item(BUCKET_ID, 'aTitle', 'myRefId', '{}') logger.info('created item %s', item['uuid']) images = client.attach_image(BUCKET_ID, item['uuid'], content_type, data) logger.info('attached image %s', images[0]['sha1']) except: logger.exception('Upload failed') raise