Я пытаюсь загрузить фотографию с boto3 в корзину s3.Я не могу заставить его работать.код ниже: - PullRequest
0 голосов
/ 24 октября 2018

Я пытаюсь загрузить фотографию с boto3 в корзину s3.Я не могу заставить его работать.Мой код:

import boto3
from botocore.client import Config


s3 = boto3.resource('s3',
    aws_access_key_id='xxxxxxx',
    aws_secret_access_key='xxxx',
    config=Config(signature_version='s3v4')

)
data = open("bbb.jpg", "rb")
s3.Bucket('indstudyphotos').put_object(Key="bbb.jpg", Body=data) 

Я получаю сообщение об ошибке: AttributeError: у объекта 'module' нет атрибута 'parse_header'

Любая помощь будет оценена.

здесьэто обратная связь:

Traceback (most recent call last):  File "/Users/joe/testPyFile.py", line 20, in <module>
s3.Bucket('indstudyphotos').put_object(Key="bbb.jpg", Body=data  File "/Library/Python/2.7/site-packages/boto3/resources/factory.py", line 520, in do_action
response = action(self, *args, **kwargs)File "/Library/Python/2.7/site-packages/boto3/resources/action.py", line 83, in __call__
response = getattr(parent.meta.client, operation_name)(**params)  File "/Users/joe/Library/Python/2.7/lib/python/site-packages/botocore/client.py", line 324, in _api_call
return self._make_api_call(operation_name, kwargs) File "/Users/joe/Library/Python/2.7/lib/python/site-packages/botocore/client.py", line 609, in _make_api_call
operation_model, request_dict)  File "/Users/joe/Library/Python/2.7/lib/python/site-packages/botocore/endpoint.py", line 143, in make_request
return self._send_request(request_dict, operation_model)  File "/Users/joe/Library/Python/2.7/lib/python/site-packages/botocore/endpoint.py", line 172, in _send_request
success_response, exception):  File "/Users/joe/Library/Python/2.7/lib/python/site-packages/botocore/endpoint.py", line 265, in _needs_retry
caught_exception=caught_exception, request_dict=request_dict)  File "/Users/joe/Library/Python/2.7/lib/python/site-packages/botocore/hooks.py", line 227, in emit
return self._emit(event_name, kwargs)  File "/Users/joe/Library/Python/2.7/lib/python/site-packages/botocore/hooks.py", line 210, in _emit
response = handler(**kwargs)  File "/Users/joe/Library/Python/2.7/lib/python/site-packages/botocore/retryhandler.py", line 183, in __call__
if self._checker(attempts, response, caught_exception):  File "/Users/joe/Library/Python/2.7/lib/python/site-packages/botocore/retryhandler.py", line 251, in __call__
caught_exception)  File "/Users/joe/Library/Python/2.7/lib/python/site-packages/botocore/retryhandler.py", line 269, in _should_retry
return self._checker(attempt_number, response, caught_exception)  File "/Users/joe/Library/Python/2.7/lib/python/site-packages/botocore/retryhandler.py", line 317, in __call__
caught_exception)  File "/Users/joe/Library/Python/2.7/lib/python/site-packages/botocore/retryhandler.py", line 223, in __call__
attempt_number, caught_exception)  File "/Users/joe/Library/Python/2.7/lib/python/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
raise caught_exception AttributeError: 'module' object has no attribute 'parse_header'

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...