]> andersk Git - jira-zephyrbot.git/blame - urllib-cert.py
More implementations.
[jira-zephyrbot.git] / urllib-cert.py
CommitLineData
a41187bd
EY
1import urllib2
2import httplib
3
4cert_file = "cert.pem"
5key_file = cert_file
6
7class HTTPSCertConnection(httplib.HTTPSConnection):
8 def __init__(self, host):
9 httplib.HTTPSConnection.__init__(self, host, None, key_file, cert_file)
10
11class 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
17opener = urllib2.build_opener(urllib2.HTTPRedirectHandler, HTTPSCertHandler)
18urllib2.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
24req = urllib2.Request(url='https://jira.mit.edu/jira/secure/mit_login.jsp?os_destination=/secure/Dashboard.jspa')
25print urllib2.urlopen(req).read()
26
This page took 0.233995 seconds and 5 git commands to generate.