Jj's web stream

Boto can't connect to bucket names with '.' dot

This is the long issue with tons of options on how to make it work:

Can't use bucket names with dots #2836 - https://github.com/boto/boto/issues/2836

This is what worked for me:

conn = boto.s3.connect_to_region( 
    boto.s3.connection.Location.USWest2, 
    aws_access_key_id=AWS_ACCESS_KEY_ID, 
    aws_secret_access_key=AWS_ACCESS_KEY_SECRET, 
    calling_format=boto.s3.connection.OrdinaryCallingFormat() 
)

Have to use connect_to_region and pass in the region where you created your bucket and use the OrdinaryCallingFormat calling format. Otherwise I'd get the following errors:

Note that this is not possible to do using boto.connect_s3.

Without sending in the region:

Traceback (most recent call last):

...

File "/home/jj/code/site/venv/lib/python3.4/site-packages/boto/s3/connection.py", line 553, in head_bucket 
response.status, response.reason, body) 
boto.exception.S3ResponseError: S3ResponseError: 301 Moved Permanently

Not using the right calling format (boto.connect_s3)

Traceback (most recent call last): 
.... 
return _old_match_hostname(cert, hostname) 
File "/usr/lib/python3.4/ssl.py", line 285, in match_hostname 
% (hostname, ', '.join(map(repr, dnsnames)))) 
ssl.CertificateError: hostname 'www.domain.com.s3-us-west-2.amazonaws.com' doesn't match either of 's3-us-west-2.amazonaws.com', '*.s3-us-west-2.amazonaws.com', 's3.us-west-2.amazonaws.com', '*.s3.us-west-2.amazonaws.com', 's3.dualstack.us-west-2.amazonaws.com', '*.s3.dualstack.us-west-2.amazonaws.com', '*.s3.amazonaws.com'