Skip to content

Instantly share code, notes, and snippets.

@richfitz
Created May 19, 2013 23:42
Show Gist options
  • Save richfitz/5609592 to your computer and use it in GitHub Desktop.
Save richfitz/5609592 to your computer and use it in GitHub Desktop.
Export issues from Github as JSON
"""
Exports Issues from a specified repository.
Uses basic authentication (Github username + password) to retrieve Issues
from a repository that username has access to. Supports Github API v3.
From:
https://gist.github.com/unbracketed/3380407
"""
import requests
GITHUB_USER = ''
GITHUB_PASSWORD = ''
REPO = '' # format is username/repo
ISSUES_FOR_REPO_URL = 'https://api.github.com/repos/%s/issues' % REPO
AUTH = (GITHUB_USER, GITHUB_PASSWORD)
r = requests.get(ISSUES_FOR_REPO_URL, auth=AUTH)
if not r.status_code == 200:
raise Exception(r.status_code)
with open('issues.json', 'w') as outfile:
json.dump(r.json(), outfile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment