()
| 11 | |
| 12 | |
| 13 | def get_issues(): |
| 14 | issues = [] |
| 15 | url = issues_url |
| 16 | while 1: |
| 17 | get_data = {"state": "all"} |
| 18 | r = requests.get(url, params=get_data) |
| 19 | data = r.json() |
| 20 | if r.status_code == 403: |
| 21 | # API request limit exceeded |
| 22 | print(data["message"]) |
| 23 | sys.exit(1) |
| 24 | issues.extend(data) |
| 25 | |
| 26 | # Look for next page |
| 27 | links = requests.utils.parse_header_links(r.headers["Link"]) |
| 28 | another_page = False |
| 29 | for link in links: |
| 30 | if link["rel"] == "next": |
| 31 | url = link["url"] |
| 32 | another_page = True |
| 33 | if not another_page: |
| 34 | return issues |
| 35 | |
| 36 | |
| 37 | def main(args): |