Created
January 26, 2009 22:52
Revisions
-
eston revised this gist
Jan 26, 2009 . 1 changed file with 6 additions and 7 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,9 +6,9 @@ import urllib2 from xml.dom import minidom lighthouse_token = '' # your token. can be read-only project_root_url = '' # e.g. project.lighthouseapp.com todo_path = '' # full path to TODO file def get_lighthouse_data(url, token): req = urllib2.Request(url) @@ -51,11 +51,10 @@ def get_lighthouse_data(url, token): for ticket in ticket_data.getElementsByTagName('ticket'): for node in ticket.childNodes: if node.nodeName == 'title': todo_file.write(node.childNodes[0].nodeValue + "\n\n") if node.nodeName == 'number': url = project_root_url + 'projects/' + project_id + '/tickets/' + node.childNodes[0].nodeValue todo_file.write(url + "\n") else: todo_file.write("No assigned tickets for this milestone.\n\n") todo_file.close() -
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,61 @@ """ Get Lighthouse tickets I am responsible for in the next milestone Eston Bond ([email protected]) """ import urllib2 from xml.dom import minidom lighthouse_token = '' project_root_url = '' todo_path = '' def get_lighthouse_data(url, token): req = urllib2.Request(url) req.add_header('X-LighthouseToken', token) r = urllib2.urlopen(req) parsed_data = minidom.parse(r) return parsed_data projects = {} # get project ids project_data = get_lighthouse_data(project_root_url + 'projects.xml', lighthouse_token) for project in project_data.getElementsByTagName('project'): project_id = None project_name = None for node in project.childNodes: if node.nodeName == 'id': project_id = (node.childNodes[0].nodeValue) if node.nodeName == 'name': project_name = (node.childNodes[0].nodeValue) if project_id and project_name: projects[project_id] = project_name # get tickets todo_file = open(todo_path, 'w') for project_id, project_name in projects.iteritems(): underscore = '' while len(underscore) < len(project_name): underscore += '-' underscore += "\n" todo_file.write(project_name + "\n" + underscore) # get ticket data project_url = project_root_url + 'projects/' + str(project_id) + '/tickets.xml?q=responsible:me%20milestone:next' ticket_data = get_lighthouse_data(project_url, lighthouse_token) if len(ticket_data.getElementsByTagName('ticket')): for ticket in ticket_data.getElementsByTagName('ticket'): for node in ticket.childNodes: if node.nodeName == 'title': todo_file.write(node.childNodes[0].nodeValue + "\n") if node.nodeName == 'number': url = project_root_url + 'projects/' + project_id + '/tickets/' + node.childNodes[0].nodeValue todo_file.write(url) else: todo_file.write("No assigned tickets for this milestone.\n") todo_file.write("\n") todo_file.close()