2012-10-05 4 views
0

Mon codePython: connexion TLS/SSL a été fermé

conn = __get_s3_connection(s3_values.get('accessKeyId'), s3_values.get('secretAccessKey')) 
key = s3_values.get('proposal_key') + proposal_unique_id + s3_values.get('proposal_append_path') 
request = urllib2.Request(conn.generate_url(s3_values.get('expires_in'), 'GET', bucket=s3_values.get('bucket'), key=key)) 
request.add_header('Accept-encoding', 'gzip') 
response = urllib2.urlopen(request) 

L'URL ressemble https://production.myorg.s3.amazonaws.com/key/document.xml.gz?Signature=signature%3D&Expires=1349462207&AWSAccessKeyId=accessId

Cette méthode fonctionnait très bien jusqu'à 1 heure de retour, mais quand je lance le même programme, il jette

Traceback (most recent call last): 
    File "/Users/hhimanshu/IdeaProjects/analytics/src/utilities/documentReader.py", line 145, in <module> 
    main() 
    File "/Users/hhimanshu/IdeaProjects/analytics/src/utilities/documentReader.py", line 141, in main 
    x = get_proposal_data_from_s3('documentId') 
    File "/Users/hhimanshu/IdeaProjects/analytics/src/utilities/documentReader.py", line 54, in get_proposal_data_from_s3 
    response = urllib2.urlopen(request) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 126, in urlopen 
    return _opener.open(url, data, timeout) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 392, in open 
    response = self._open(req, data) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 410, in _open 
    '_open', req) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 370, in _call_chain 
    result = func(*args) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1194, in https_open 
    return self.do_open(httplib.HTTPSConnection, req) 
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1161, in do_open 
    raise URLError(err) 
urllib2.URLError: <urlopen error [Errno 6] _ssl.c:503: TLS/SSL connection has been closed> 

Quelle pourrait être la raison? Comment puis-je éviter cette situation?

Répondre

2

Cela était dû à une connexion Internet intermittente. Résolu sur son propre

+0

Vous pouvez accepter votre propre réponse, btw – 9000

+0

J'ai essayé, SO dit que vous devez attendre 24 heures, je le ferai demain – daydreamer

Questions connexes