Created
September 29, 2014 09:19
-
-
Save rob-b/8076767224b1e634fca3 to your computer and use it in GitHub Desktop.
Requires `PyGithub` and `unicodecsv`
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 characters
import cStringIO | |
import unicodecsv | |
from github import Github | |
repo = 'USER/REPO' | |
token = 'GITHUBTOKENHERE' | |
def main(): | |
g = Github(token) | |
github_repo = g.get_repo(repo) | |
header = [u'#', u'Title', u'State', u'Labels'] | |
fo = cStringIO.StringIO() | |
csvout = unicodecsv.writer(fo) | |
csvout.writerow(header) | |
rows = [] | |
for issue in github_repo.get_issues(): | |
labels = ','.join([l.name for l in issue.labels]) | |
rows.append((issue.number, issue.title, issue.state, labels)) | |
for row in sorted(rows, key=lambda s: s[-1]): | |
csvout.writerow(row) | |
print fo.getvalue() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment