]> andersk Git - jira-zephyrbot.git/blob - jirabot.py
Initial commit.
[jira-zephyrbot.git] / jirabot.py
1 import zephyr
2 import feedparser
3 import pycurl
4
5 """Screen scrapes jira.mit.edu. Supposedly. Doesn't actually work yet.
6
7 You need to have a personal certificate named cert.pem in this
8 directory to run this script. You also need the abovementioned scripts.
9 The zephyr bindings can be gotten from ebroder's GitHub repository
10 located: http://github.com/ebroder/python-zephyr/tree/master
11
12 SSL server CA authentication is disabled because we don't know how to
13 make curl stop complaining.
14
15 Current difficulty is we are causing a NullPointer exception on
16 (we think) touchstone's servers."""
17
18 class Browser(object):
19     def __init__(self, **kwargs):
20         self.opts = kwargs
21         self.lastResult = None
22     def _callback(self, buf):
23         self.lastResult += buf
24     def get(self, url):
25         c = pycurl.Curl()
26         c.setopt(c.URL, url)
27         c.setopt(c.WRITEFUNCTION, self._callback)
28         for k,v in self.opts.items():
29             c.setopt(getattr(c, k), v)
30         self.lastResult = ''
31         c.perform()
32         return self.lastResult
33
34 b = Browser(
35     SSLCERT = "cert.pem",
36     SSLKEY = "cert.pem",
37     SSL_VERIFYPEER = 0,
38     COOKIEJAR = "jirabot.cookie",
39     FOLLOWLOCATION = 1,
40 )
41
42 b.get("https://jira.mit.edu/jira/secure/Dashboard.jspa")
43 print b.get("https://jira.mit.edu/jira/secure/mit_login.jsp?os_destination=/secure/Dashboard.jspa")
44
45 #c.setopt(c.URL, "https://jira.mit.edu/jira/sr/jira.issueviews:searchrequest-rss/temp/SearchRequest.xml?&pid=10185&updated%3Aprevious=-1w&sorter/field=updated&sorter/order=DESC&tempMax=1000")
46
47 #d = feedparser.parse(t.contents)
48 #print d
49
This page took 0.039242 seconds and 5 git commands to generate.