Skip to content

Instantly share code, notes, and snippets.

@jossef
Created March 22, 2015 07:36
Show Gist options
  • Select an option

  • Save jossef/afc5ce0c9de1f6ddcc2d to your computer and use it in GitHub Desktop.

Select an option

Save jossef/afc5ce0c9de1f6ddcc2d to your computer and use it in GitHub Desktop.
Github API Get Opened Issues count
#!/usr/bin/python
import requests
import re
url = 'https://api.github.com/repos/<username>/<repo name>/issues'
args = {
'access_token': '<Your Access Token Here>',
'state': 'open',
'per_page': 1
}
def get_opened_issues():
r = requests.get(url, params=args)
link = r.headers['link']
opened_issues = re.findall('page=(\d+)>; rel="last"', link)
return opened_issues[0]
print get_opened_issues()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment