-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths3_base.py
27 lines (20 loc) · 823 Bytes
/
s3_base.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import asyncio
import aiobotocore
async def main():
session = aiobotocore.get_session()
async with session.create_client(service_name='s3',
use_ssl=False, endpoint_url='http://localhost:7000',
aws_access_key_id='AKIAIOSFODNN7EXAMPLE', aws_secret_access_key='wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY222'
, region_name='us-west-2') as client:
resp = await client.put_object(
Bucket='test',
Key='e1',
Body='ddddddddddd'
)
response = await client.get_object(Bucket='test1', Key='e1')
async with response['Body'] as stream:
data = await stream.read()
print(data)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()