Skip to content

Instantly share code, notes, and snippets.

@redbo
Created June 19, 2018 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redbo/24a822eaed4cae016fa857e89e120f55 to your computer and use it in GitHub Desktop.
Save redbo/24a822eaed4cae016fa857e89e120f55 to your computer and use it in GitHub Desktop.
# export OS_USERNAME=tester
# export OS_PASSWORD=testing
# export OS_PROJECT_NAME=test
# export OS_TENANT_NAME=test
# export OS_AUTH_URL=http://localhost:5000/v3
# export OS_IDENTITY_API_VERSION=3
# export OS_AUTH_VERSION=3
#
# openstack ec2 credentials create
import boto
from boto.s3.connection import S3Connection
from swiftly.client.standardclient import StandardClient
cl = StandardClient(auth_url='http://127.0.0.1:5000/v2.0',
auth_tenant='test', auth_user='tester', auth_key='testing')
cl.auth()
cl.put_container('XXX')
cl.put_object('XXX', 'test-object',
'THIS IS SOME DATA', headers={'Content-Type': 'text/plain'})
connection = S3Connection(
aws_access_key_id="40e97a98169a43e4a96a79585fe1ed5a", # "access" from ec2 creds
aws_secret_access_key="844c7420b64a45f98de57a4ddeb0c067", # "secret" from ec2 creds
port=8080,
host='127.0.0.1',
is_secure=False,
calling_format=boto.s3.connection.OrdinaryCallingFormat()
)
print connection.get_all_buckets()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment