Created
May 18, 2015 08:20
-
-
Save pudo/6057d06676aa5f83d72d to your computer and use it in GitHub Desktop.
Failing to upload via S3 from morph.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import boto | |
import boto.s3 | |
from boto.s3.key import Key | |
def upload(): | |
conn = boto.connect_s3(os.environ.get('MORPH_AWS_ACCESS_KEY_ID'), | |
os.environ.get('MORPH_AWS_SECRET_ACCESS_KEY'), | |
validate_certs=False) | |
bucket = conn.get_bucket('offenesparlament') | |
k = Key(bucket) | |
k.key = 'popolo-test.txt' | |
k.set_contents_from_string("I'm a banana!") | |
k.set_metadata('Content-Type', 'text/plain') | |
k.make_public() | |
print k.generate_url(0, query_auth=False, force_http=True) | |
if __name__ == '__main__': | |
upload() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment