def upload_file():
    if request.method == 'POST':
        file = request.files['file']
if file and allowed_file(file.filename):
    filename = secure_filename(file.filename)
conn = S3Connection('credentials', '')
bucket = conn.create_bucket('bucketname')
k = Key(bucket)
k.key = 'foobar'
k.set_contents_from_string(file.readlines())
return 'Success!'
Использование Amazon S3 с Heroku, Python и Flask