def add_milestones_with_no_issues(milestones): output = milestones.copy() resp = requests.get(c.get_milestone_url(v._CONFIG_), auth=c.get_basic_auth_credentials(v._CONFIG_)) if resp.status_code == 200: empty_milestones = [m for m in simplejson.loads(resp.content) if m['open_issues'] == 0] for ms in empty_milestones: output[(ms['number'], ms['title'], ms['description'], ms['due_on'])] = [] else: print 'Unexpected reponse' return output
def fetch_issues(): def error(): print 'Unexpected reponse' print 'Status: %s' % resp.status_code sys.exit(1) resp = requests.get(c.get_issues_url(v._CONFIG_), auth=c.get_basic_auth_credentials(v._CONFIG_)) if resp.status_code == 200: issues = simplejson.loads(resp.content) resp = requests.get(c.get_issues_url(v._CONFIG_), auth=c.get_basic_auth_credentials(v._CONFIG_), params={'state': 'closed'}) if resp.status_code == 200: issues = issues + simplejson.loads(resp.content) else: error() else: error() return issues
def add_milestones_with_no_issues(milestones): output = milestones.copy() resp = requests.get(c.get_milestone_url(v._CONFIG_), auth=c.get_basic_auth_credentials(v._CONFIG_)) if resp.status_code == 200: empty_milestones = [ m for m in simplejson.loads(resp.content) if m['open_issues'] == 0 ] for ms in empty_milestones: output[(ms['number'], ms['title'], ms['description'], ms['due_on'])] = [] else: print 'Unexpected reponse' return output
def main2(): try: c.setup('roadmap.md') resp = requests.get(c.get_milestone_url(v._CONFIG_), auth=c.get_basic_auth_credentials(v._CONFIG_)) if resp.status_code == 200: fmt.h1('Technology Roadmap') milestones = simplejson.loads(resp.content) for milestone in milestones: write_milestone(milestone) print 'Done.' else: print 'Unexpected reponse' print 'Status: %s' % resp.status_code finally: c.teardown()
def main(milestone): try: c.setup("issues.md") resp = requests.get(c.get_issues_url(v._CONFIG_), auth=c.get_basic_auth_credentials(v._CONFIG_), params={'milestone': milestone}) if resp.status_code == 200: fmt.h1("Issues") issues = simplejson.loads(resp.content) for issue in issues: write_issue(issue) print "Done." else: print "Unexpected reponse" print "Status: %s" % resp.status_code finally: c.teardown()