私のコード:
@trust_all_certificates
def go_url(self, url, data=None, headers={}):
global response
request = urllib2.Request(url, data, headers)
request.add_header('Authorization', 'Basic %s' % self.AdminAuthBase64)
for x in xrange(3):
try:
response = urllib2.urlopen(request)
break
except IOError, e:
if hasattr(e, 'reason'):
API.log('We failed to reach a server. Reason: ' + str(e.reason))
elif hasattr(e, 'code'):
API.log('The server couldn\'t fulfill the request. Error code: ' + str(e.code))
sleep(30)
else:
API.halt('Can not send an request to server')
例外:
We failed to reach a server.
Reason: [Errno 1] Unmapped exception: java.lang.NullPointerException
Got this failure java.lang.NullPointerException during SSL handshake (<_realsocket at 0x9d type=client open_count=1 channel=[id: 0xda3c990d, /my ip => to ip] timeout=60.0>)
最も興味深いのは、これが一定ではなく、Jython 2.7 しかなく、Jython 2.5 が正しく動作することです。