]> andersk Git - jira-zephyrbot.git/blob - jirabot2.py
Add README.
[jira-zephyrbot.git] / jirabot2.py
1 import httplib
2 import mechanize
3
4 def 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
20 cj = mechanize.CookieJar()
21
22 cert_handler = make_cert_handler("cert.pem")
23 opener = mechanize.build_opener(mechanize.HTTPRedirectHandler, cert_handler, mechanize.HTTPCookieProcessor(cj))
24 mechanize.install_opener(opener)
25
26 b = mechanize.Browser()
27 b.set_handle_robots(False)
28 b.addheaders = [("Accept-Language", "en-us,en;q=0.5"),]
29 b.open("https://jira.mit.edu/jira/secure/Dashboard.jsp://jira.mit.edu/jira/secure/Dashboard.jspa")
30 b.follow_link(text="MIT Touchstone")
This page took 0.118814 seconds and 5 git commands to generate.