import tinys3
conn =tinys3.Connection(aws_key_id,aws_secrert_key)
f = open('c:/Users/Akhil/Downloads/New/img033.jpg','rb')
conn.upload('c:/Users/Akhil/Downloads/New/img033.jpg',f,'matt3r')
我正在尝试将下面显示的本地目录中的图像上传到aws s3 matt3r bucket。当我运行这个时,我收到以下错误:
Traceback (most recent call last):
File "conn.py", line 6, in <module>
conn.upload('c:/Users/Akhil/Downloads/New/img033.jpg',f,'matt3r')
File "C:\Python27\lib\site-packages\tinys3\connection.py", line 171, in upload
return self.run(r)
File "C:\Python27\lib\site-packages\tinys3\connection.py", line 262, in run
return self._handle_request(request)
File "C:\Python27\lib\site-packages\tinys3\connection.py", line 356, in _handle_request
return request.run()
File "C:\Python27\lib\site-packages\tinys3\request_factory.py", line 346, in run
auth=self.auth)
File "C:\Python27\lib\site-packages\requests\api.py", line 123, in put
return request('put', url, data=data, **kwargs)
File "C:\Python27\lib\site-packages\requests\api.py", line 56, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 596, in send
r = adapter.send(request, **kwargs)
File "C:\Python27\lib\site-packages\requests\adapters.py", line 473, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(10054, 'An existing connection was forcibly closed by the remote host'))
答案 0 :(得分:0)
您需要将AWS S3的策略添加到您的IAM用户。