summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas ten Cate <ttencate@gmail.com>2012-12-08 03:55:32 -0800
committerThomas ten Cate <ttencate@gmail.com>2012-12-08 03:55:32 -0800
commitd5b4b50453d452f56950ea5dea4b7c483caaa375 (patch)
tree9cb7e36490b31d7c5c95a148b56d519657a827ff
parentba821d25b6dba3f466597b82fb9de520e0814299 (diff)
parent6e33f1b1bfd80173dbb5d2aa5f34a7730032fbd8 (diff)
Merge pull request #6 from simsong/master
allows different users to authenticate and handles authentication errors.
-rwxr-xr-xissues.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/issues.py b/issues.py
index bbb6bce..d50c3b1 100755
--- a/issues.py
+++ b/issues.py
@@ -8,6 +8,7 @@ import optparse
parser = optparse.OptionParser(usage='Usage: %prog [options] sfexport.xml githubuser/repo')
parser.add_option('-s', '--start', dest='start_id', action='store', help='id of first issue to import; useful for aborted runs')
+parser.add_option('-u', '--user', dest='github_user')
opts, args = parser.parse_args()
try:
@@ -17,6 +18,9 @@ except (ValueError, IndexError):
parser.print_help()
sys.exit(1)
+if opts.github_user:
+ github_user = opts.github_user
+
from BeautifulSoup import BeautifulStoneSoup
print 'Parsing XML export...'
@@ -124,6 +128,8 @@ def handle_tracker_item(item, issue_title_prefix):
print "ISSUE CAUSED SERVER SIDE ERROR AND WAS NOT SAVED!!! Import will continue."
else:
issue = response.json
+ if 'number' not in issue:
+ raise RuntimeError("No 'number' in issue; response %d invalid" % response.status_code)
number = issue['number']
print 'Attaching labels: %s' % labels
rest_call('POST', 'issues/%s/labels' % (number), labels)