]> andersk Git - jira-zephyrbot.git/blame - jirabot2.py
Add README.
[jira-zephyrbot.git] / jirabot2.py
CommitLineData
a41187bd
EY
1import httplib
2import mechanize
3
4def make_cert_handler(key_file=None, cert_file=None):
5 if cert_file is None:
6 cert_file = key_file
7
8 class HTTPSCertConnection(httplib.HTTPSConnection):
9 def __init__(self, host):
10 httplib.HTTPSConnection.__init__(self, host,
11 key_file=key_file,
12 cert_file=cert_file)
13
14 class HTTPSCertHandler(mechanize.HTTPSHandler):
15 def https_open(self, req):
16 return self.do_open(HTTPSCertConnection, req)
17
18 return HTTPSCertHandler
19
20cj = mechanize.CookieJar()
21
22cert_handler = make_cert_handler("cert.pem")
23opener = mechanize.build_opener(mechanize.HTTPRedirectHandler, cert_handler, mechanize.HTTPCookieProcessor(cj))
24mechanize.install_opener(opener)
25
26b = mechanize.Browser()
27b.set_handle_robots(False)
28b.addheaders = [("Accept-Language", "en-us,en;q=0.5"),]
29b.open("https://jira.mit.edu/jira/secure/Dashboard.jsp://jira.mit.edu/jira/secure/Dashboard.jspa")
30b.follow_link(text="MIT Touchstone")
This page took 0.275875 seconds and 5 git commands to generate.