I have written a python script to connect to an amazon s3 server but it seems to fail when attempting to create a bucket (a time out error). I have omitted the secret key and id key for obvious reasons. Can anyone see what is wrong with this script? Thanks in advance
import boto
import sys, os
from boto.s3.key import Key
from boto.s3.connection import S3Connection
from boto.exception import S3ResponseError
LOCAL_PATH = '/Users/****/test'
aws_access_key_id = '****'
aws_secret_access_key = '****'
bucket_name = aws_access_key_id.lower() + '****'
class TimeoutException(Exception):
pass
conn = boto.connect_s3(aws_access_key_id, aws_secret_access_key)
try:
print "bucket name " + bucket_name;
bucket = conn.get_bucket( bucket_name)
except TimeoutException:
sys.exit("Connection timed out; this usually means you're offline.")
except S3ResponseError, exception_data:
sys.exit(exception_data.error_message)
this is the error message i get:
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 941, in request self._send_request(method, url, body, headers) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 975, in _send_request self.endheaders(body) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 937, in endheaders self._send_output(message_body) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 797, in _send_output self.send(msg) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 759, in send self.connect() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1140, in connect self.timeout, self.source_address) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 571, in create_connection raise err socket.timeout: timed out