Mise à jour:délai d'attente httplib.HTTPSConnection lors de la connexion à Amazon Web Services
j'ai pu restreindre le ci-dessous pour:
>>> import httplib
>>> h1 = httplib.HTTPSConnection('s3.amazonaws.com')
>>> h1.request ("GET", "/")
Traceback (most recent call last):
File "<console>", line 1, in <module>
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
Attendu que:
>>> h1 = httplib.HTTPSConnection('google.com')
>>> h1.request ("GET", "/")
>>> r1 = h1.getresponse()
>>> print r1.status, r1.reason
301 Moved Permanently
Qu'est-ce à propos d'AWS qui est terrifiant httplib.HTTPSConnection?
(Je sais que la demande ci-dessus n'est pas une demande AWS correcte et complète, mais je l'ai simplifié juste pour essayer d'obtenir une réponse du serveur.)
demande d'origine:
S'il vous plaît aider un développeur désespéré. J'ai suivi toutes les instructions pour installer et activer django-stockages et boto dans mon application pour télécharger des fichiers sur S3. (. Comme cette application est conçue pour le déploiement sur Heroku, j'utilise virtualenv pour gérer les dépendances)
Pour le développement local, je l'ai mis toutes mes lettres de créance dans ~/.bash_profile:
export AWS_ACCESS_KEY_ID=xxxx
export AWS_SECRET_ACCESS_KEY=yyyy
export S3_BUCKET_NAME=zzzz
Ainsi, grande, mais ceci:
> python manage.py shell
>>> import boto
>>> conn = boto.connect_s3()
>>> conn.get_all_buckets()
produit ces messages de débogage et cette erreur:
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 "<console>", line 1, in <module>
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
Ce que je n'arrive pas à comprendre, c'est qu'en utilisant les MÊMES POUVOIRS EXACT, je peux me connecter sans aucun problème en utilisant une interface graphique sur mon Mac pour naviguer sur S3. Je peux énumérer tous les seaux. Je peux entrer dans le seau zzzz. Je peux télécharger un fichier dessus. Je peux le télécharger à nouveau. Je peux le supprimer. Tout est bien. Mais peu importe ce que j'essaie à travers Boto, il expire sans autre commentaire.
Pourquoi le boto arrive-t-il dans mon environnement local ?!
Avez-vous déjà trouvé pourquoi? Je devais créer un fichier /etc/boto.cfg et y placer '[Boto] \ nis_secure = false' pour le faire fonctionner. –