-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimport-github.py
executable file
·41 lines (25 loc) · 1013 Bytes
/
import-github.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/python
import sys, time
from github2 import client
from xml.etree.ElementTree import fromstring
xmltext = sys.stdin.read()
xmlroot = fromstring(xmltext)
title = xmlroot.find("short_desc").text
body = xmlroot.findall("long_desc")[0].find("thetext").text
comment_text = ""
for comment in xmlroot.findall("long_desc")[1:]:
ct = comment.find("thetext").text
if ct.strip() == "The feature's description has been updated.":
continue
else:
comment_text = "%s%s\n" % (comment_text, ct.strip())
print "creating %s" % title
#gc = client.Github(username="",api_token="",proxy_host="", proxy_port=8080)
gc = client.Github(username="",api_token="",requests_per_second=1)
new_issue = gc.issues.open("MeeGoIntegration/Issues", title=title, body=body)
print "created %s" % str(new_issue.number)
time.sleep(1)
if comment_text:
gc.issues.comment("MeeGoIntegration/Issues", new_issue.number, comment_text)
print "commented %s" % str(new_issue.number)
time.sleep(1)