def to_s3(ident, doc_type):
os.environ['http_proxy'] = 'http://dumont.getty.edu:80'
os.environ['https_proxy'] = 'https://dumont.getty.edu:80'
# Connect to s3 and get bucket
rw = boto.connect_s3(aws_access_key_id=aws_access,
aws_secret_access_key=aws_secret)
b = rw.get_bucket(aws_bucket)
print('{}{}/{}.json'.format(iiif_prezi_base, ident, doc_type))
k = Key(b, '{}{}/{}.json'.format(iiif_prezi_base, ident, doc_type))
if doc_type == 'collection':
print('{}/{}/collection.json'.format(collection_dir, ident))
k.set_contents_from_filename('{}/{}/collection.json'.format(collection_dir, ident))
elif doc_type == 'manifest':
print('{}/{}/manifest.json'.format(manifest_dir, ident))
k.set_contents_from_filename('{}/{}/manifest.json'.format(manifest_dir, ident))
c.execute('INSERT OR REPLACE INTO {}_prezi_docs VALUES (?, ?)'.format(project), (ident, 1))
conn.commit()
print('{} complete and added to DB'.format(ident))
评论列表
文章目录