OILS / devtools / services / github_issues.py View on Github | oilshell.org

42 lines, 19 significant
1#!/usr/bin/env python2
2"""
3github_issues.py
4"""
5from __future__ import print_function
6
7import cgi
8import json
9import sys
10
11
12def main(argv):
13 # - .number
14 # - .title
15 # - .html_url
16 #
17 # And then format as HTML.
18
19 issues = json.load(sys.stdin)
20 for issue in issues: # dict
21 d = {}
22 d['html_url'] = issue['html_url'].encode('utf-8')
23 d['number'] = issue['number']
24 d['title'] = cgi.escape(issue['title'].encode('utf-8'))
25 print('''\
26<tr>
27 <td class="issue-num">
28 <a href="%(html_url)s">#%(number)s</a>
29 </td>
30 <td class="issue-title">
31 %(title)s
32 </td>
33</tr>
34''' % d)
35
36
37if __name__ == '__main__':
38 try:
39 main(sys.argv)
40 except RuntimeError as e:
41 print('FATAL: %s' % e, file=sys.stderr)
42 sys.exit(1)