Created
March 22, 2015 07:36
-
-
Save jossef/afc5ce0c9de1f6ddcc2d to your computer and use it in GitHub Desktop.
Github API Get Opened Issues count
This file contains hidden or 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
| #!/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