-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebug_github.py
More file actions
38 lines (34 loc) · 1.01 KB
/
Copy pathdebug_github.py
File metadata and controls
38 lines (34 loc) · 1.01 KB
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
31
32
33
34
35
36
37
38
import requests
import os
repo = "ckeditor/ckeditor5"
url = f"https://api.github.com/repos/{repo}/issues"
params = {
"state": "open",
"per_page": 5
}
headers = {
"Accept": "application/vnd.github.v3+json"
}
print(f"Fetching from {url}...")
response = requests.get(url, headers=headers, params=params)
print(f"Status: {response.status_code}")
if response.status_code == 200:
issues = response.json()
print(f"Found {len(issues)} issues (generic search).")
if len(issues) > 0:
print("First issue labels:")
for label in issues[0]['labels']:
print(f" - {label['name']}")
else:
print(response.text)
# Test with specific label
label = "accessibility"
params['labels'] = label
print(f"\nFetching with label='{label}'...")
response = requests.get(url, headers=headers, params=params)
print(f"Status: {response.status_code}")
if response.status_code == 200:
issues = response.json()
print(f"Found {len(issues)} issues with label '{label}'.")
else:
print(response.text)