forked from amand33p/bug-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_issues_Extract.py
More file actions
30 lines (26 loc) · 919 Bytes
/
python_issues_Extract.py
File metadata and controls
30 lines (26 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import requests
import json
def download_angular_issues(token):
url = "https://api.github.com/repos/angular/angular/issues"
headers = {
"Authorization": f"token {token}",
"Accept": "application/vnd.github.v3+json"
}
params = {
"state": "all",
"per_page": 100
}
issues = []
while url:
response = requests.get(url, headers=headers, params=params)
if response.status_code == 200:
issues += response.json()
# Update the url variable with the link to the next page of results
url = response.links.get('next', {}).get('url')
else:
print(f"Failed to retrieve issues. Status code: {response.status_code}")
break
with open("angular_issues.json", "w") as f:
json.dump(issues, f)
token = "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"
download_angular_issues(token)