jirabot2 that can log in.
[jira-zephyrbot.git] / urllib-cert.py
blob37810269164fb96731856b2bdf6f827987d8af68
1 import urllib2
2 import httplib
4 cert_file = "cert.pem"
5 key_file = cert_file
7 class HTTPSCertConnection(httplib.HTTPSConnection):
8 def __init__(self, host):
9 httplib.HTTPSConnection.__init__(self, host, None, key_file, cert_file)
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)
17 opener = urllib2.build_opener(urllib2.HTTPRedirectHandler, HTTPSCertHandler)
18 urllib2.install_opener(opener)
20 #req = urllib2.Request(url='https://geofft.scripts.mit.edu:444/detect.php')
21 #f = urllib2.urlopen(req)
22 #print f.read()
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()