⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
rgw
All Projects
Ceph
»
rgw
Overview
Activity
Roadmap
Issues
Spent time
Gantt
Download (804 Bytes)
Bug #13207
ยป testauthenticatedread.py
Rahul Aggarwal
, 09/23/2015 10:41 AM
import
boto
import
requests
import
boto.s3.connection
from
boto
import
exception
access_key
=
'
8d52e5231eed4a899220e7e85affd840
'
secret_key
=
'
03ad4895c4f9465aa57ff8d116d9eebb
'
boto
.
config
.
add_section
(
"
Boto
"
)
boto
.
config
.
set
(
"
Boto
"
,
"
num_retries
"
,
"
1
"
)
conn
=
boto
.
connect_s3
(
aws_access_key_id
=
access_key
,
aws_secret_access_key
=
secret_key
,
port
=
80
,
host
=
'
localhost
'
,
is_secure
=
True
,
calling_format
=
boto
.
s3
.
connection
.
OrdinaryCallingFormat
(),
debug
=
1
)
bucket
=
conn
.
create_bucket
(
"
new_cont1
"
)
bucket
.
set_canned_acl
(
'
authenticated-read
'
)
key
=
bucket
.
new_key
(
"
one
"
)
key
.
set_contents_from_string
(
"
testing bucket level acl
"
)
url
=
bucket
.
generate_url
(
3600
)
l
=
url
.
split
(
"
/
"
)
url
=
l
[
0
]
+
"
/
"
+
"
/
"
+
l
[
2
]
+
"
/
"
+
l
[
3
]
r
=
requests
.
get
(
url
)
data
=
r
.
text
print
data
assert
(
r
.
status_code
==
403
)
(1-1/1)
Loading...