]>
Commit | Line | Data |
---|---|---|
a41187bd EY |
1 | import urllib2 |
2 | import httplib | |
3 | ||
4 | cert_file = "cert.pem" | |
5 | key_file = cert_file | |
6 | ||
7 | class HTTPSCertConnection(httplib.HTTPSConnection): | |
8 | def __init__(self, host): | |
9 | httplib.HTTPSConnection.__init__(self, host, None, key_file, cert_file) | |
10 | ||
11 | class HTTPSCertHandler(urllib2.HTTPSHandler): | |
12 | def do_open(self, http_class, req): | |
13 | if http_class is httplib.HTTPSConnection: | |
14 | http_class = HTTPSCertConnection | |
15 | return urllib2.HTTPSHandler.do_open(self, http_class, req) | |
16 | ||
17 | opener = urllib2.build_opener(urllib2.HTTPRedirectHandler, HTTPSCertHandler) | |
18 | urllib2.install_opener(opener) | |
19 | ||
20 | #req = urllib2.Request(url='https://geofft.scripts.mit.edu:444/detect.php') | |
21 | #f = urllib2.urlopen(req) | |
22 | #print f.read() | |
23 | ||
24 | req = urllib2.Request(url='https://jira.mit.edu/jira/secure/mit_login.jsp?os_destination=/secure/Dashboard.jspa') | |
25 | print urllib2.urlopen(req).read() | |
26 |