⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
rgw
All Projects
Ceph
»
rgw
Overview
Activity
Roadmap
Issues
Spent time
Gantt
Download (1.07 KB)
Bug #15358
» test-bugfix-15358-aws.py
Test bugfix against Amazon S3 -
Javier M. Mellid
, 04/05/2016 10:45 PM
#!/usr/bin/python
import
os
import
boto
import
boto.s3.connection
from
boto.s3.connection
import
Location
AWS_ACCESS_KEY_ID
=
'
KEY_ID
'
AWS_SECRET_ACCESS_KEY
=
'
ACCESS_KEY
'
bucket_name
=
'
bucket-name-0982323239293
'
if
not
boto
.
config
.
get
(
'
s3
'
,
'
use-sigv4
'
):
boto
.
config
.
add_section
(
'
s3
'
)
boto
.
config
.
set
(
'
s3
'
,
'
use-sigv4
'
,
'
True
'
)
conn
=
boto
.
connect_s3
(
aws_access_key_id
=
AWS_ACCESS_KEY_ID
,
aws_secret_access_key
=
AWS_SECRET_ACCESS_KEY
,
is_secure
=
False
,
calling_format
=
boto
.
s3
.
connection
.
OrdinaryCallingFormat
(),
host
=
'
s3-eu-west-1.amazonaws.com
'
,
)
try
:
bucket
=
conn
.
create_bucket
(
bucket_name
,
location
=
'
eu-west-1
'
)
except
Exception
:
pass
for
bucket
in
conn
.
get_all_buckets
():
print
"
{name}
\t
{created}
"
.
format
(
name
=
bucket
.
name
,
created
=
bucket
.
creation_date
,
)
for
key
in
bucket
.
list
(
prefix
=
'
logs%2F
'
):
# raises bug: 'logs/' works but 'logs%2F' fails
print
"
{name}
\t
{size}
\t
{modified}
"
.
format
(
name
=
key
.
name
,
size
=
key
.
size
,
modified
=
key
.
last_modified
,
)
« Previous
1
2
3
Next »
(1-1/3)
Loading...