boto3
How do you use an HTTP/HTTPS proxy with boto3?
As of at least version 1.5.79, botocore accepts a proxies argument in the botocore config. e.g. import boto3 from botocore.config import Config boto3.resource(‘s3’, config=Config(proxies={‘https’: ‘foo.bar:3128’})) boto3 resource https://boto3.readthedocs.io/en/latest/reference/core/session.html#boto3.session.Session.resource botocore config https://botocore.readthedocs.io/en/stable/reference/config.html#botocore.config.Config
How to catch `botocore.errorfactory.UserNotFoundException`?
When an exception is created by botocore.error_factory then it is not possible to directly import it. Instead of direct import, you should use generated classes for exceptions. A list of possible exceptions is provided for each operation in the documentation. For example, for CognitoIdentityProvider.Client.admin_get_user, possible exceptions are: CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException CognitoIdentityProvider.Client.exceptions.InvalidParameterException CognitoIdentityProvider.Client.exceptions.TooManyRequestsException CognitoIdentityProvider.Client.exceptions.NotAuthorizedException CognitoIdentityProvider.Client.exceptions.UserNotFoundException CognitoIdentityProvider.Client.exceptions.InternalErrorException There is … Read more
How do I get the size of a boto3 Collection?
There is no way to get the count of keys in a bucket without listing all the objects this is a limitation of AWS S3 (see https://forums.aws.amazon.com/thread.jspa?messageID=164220). Getting the Object Summaries (HEAD) doesn’t get the actual data so should be a relatively inexpensive operation and if you are just discarding the list then you could … Read more