Note that there are some explanatory texts on larger screens.

plurals
  1. POhttplib.HTTPSConnection timeout when connecting to Amazon Web Services
    primarykey
    data
    text
    <p><strong>Update:</strong></p> <p>I was able to narrow down the below to:</p> <pre><code>&gt;&gt;&gt; import httplib &gt;&gt;&gt; h1 = httplib.HTTPSConnection('s3.amazonaws.com') &gt;&gt;&gt; h1.request ("GET", "/") Traceback (most recent call last): File "&lt;console&gt;", line 1, in &lt;module&gt; File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 958, in request self._send_request(method, url, body, headers) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 992, in _send_request self.endheaders(body) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 954, in endheaders self._send_output(message_body) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 814, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 776, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1161, in connect self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 382, in wrap_socket ciphers=ciphers) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 143, in __init__ self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 306, in do_handshake self._sslobj.do_handshake() error: [Errno 60] Operation timed out </code></pre> <p>Whereas:</p> <pre><code>&gt;&gt;&gt; h1 = httplib.HTTPSConnection('google.com') &gt;&gt;&gt; h1.request ("GET", "/") &gt;&gt;&gt; r1 = h1.getresponse() &gt;&gt;&gt; print r1.status, r1.reason 301 Moved Permanently </code></pre> <p>What is it about AWS that is freaking httplib.HTTPSConnection out? </p> <p>(I know the request above isn't a correct and complete AWS request, but I simplified it just to try to get a response from the server.)</p> <p><strong>Original request:</strong></p> <p>Please help a desperate developer. I've followed all the instructions for installing and enabling django-storages and boto in my app to upload files to S3. (As this application is intended for deployment on Heroku, I'm using virtualenv to manage dependencies.)</p> <p>For local development I've put all my credentials in ~/.bash_profile:</p> <pre><code>export AWS_ACCESS_KEY_ID=xxxx export AWS_SECRET_ACCESS_KEY=yyyy export S3_BUCKET_NAME=zzzz </code></pre> <p>So, great, but then this:</p> <pre><code>&gt; python manage.py shell &gt;&gt;&gt; import boto &gt;&gt;&gt; conn = boto.connect_s3() &gt;&gt;&gt; conn.get_all_buckets() </code></pre> <p>Produces these debugging messages and this error:</p> <pre><code>2012-06-04 23:17:34,432 [DEBUG] boto: path=/ 2012-06-04 23:17:34,432 [DEBUG] boto: auth_path=/ 2012-06-04 23:17:34,433 [DEBUG] boto: Method: GET 2012-06-04 23:17:34,433 [DEBUG] boto: Path: / 2012-06-04 23:17:34,433 [DEBUG] boto: Data: 2012-06-04 23:17:34,433 [DEBUG] boto: Headers: {} 2012-06-04 23:17:34,433 [DEBUG] boto: Host: s3.amazonaws.com 2012-06-04 23:17:34,433 [DEBUG] boto: establishing HTTPS connection: host=s3.amazonaws.com, kwargs={'timeout': 2} 2012-06-04 23:17:34,433 [DEBUG] boto: Token: None 2012-06-04 23:17:34,436 [DEBUG] boto: StringToSign: GET Tue, 05 Jun 2012 03:17:34 GMT 2012-06-04 23:17:36,900 [DEBUG] boto: encountered SSLError exception, reconnecting 2012-06-04 23:17:36,901 [DEBUG] boto: establishing HTTPS connection: host=s3.amazonaws.com, kwargs={'timeout': 2} Traceback (most recent call last): File "&lt;console&gt;", line 1, in &lt;module&gt; File "../venv/lib/python2.7/site-packages/boto/s3/connection.py", line 346, in get_all_buckets response = self.make_request('GET', headers=headers) File "../venv/lib/python2.7/site-packages/boto/s3/connection.py", line 454, in make_request override_num_retries=override_num_retries) File "../venv/lib/python2.7/site-packages/boto/connection.py", line 838, in make_request return self._mexe(http_request, sender, override_num_retries) File "../venv/lib/python2.7/site-packages/boto/connection.py", line 803, in _mexe raise e SSLError: _ssl.c:484: The handshake operation timed out </code></pre> <p>What I can't understand is that using the SAME EXACT CREDENTIALS I am able to connect without any problems using a GUI on my Mac to browse S3. I can list all the buckets. I can get into bucket zzzz. I can upload a file to it. I can download it again. I can delete it. All is well. But no matter what I try through Boto it times out with no further comment.</p> <p><strong>Why is boto timing out in my local environment?!</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload