I am trying to pull issues from the github tensorflow repo, that have more than 250 comments. However, I always receive 30 results (in accordance with GitHubs Pagination), when I should only receive 2 results.
Here’s my code:
owner = "tensorflow"
repo = "tensorflow"
n_comments = 250
url = f"https://api.github.com/repos/{owner}/{repo}/issues"
token = "mytokenhere"
params = {
'sort':'comments-desc',
'q': 'comments:>{n_comments}',
}
headers = {
"Authorization": f"token {token}",
"Accept": "application/vnd.github.v3+json" # specifying json-formatted data
}
response = requests.get(url, headers = headers, params = params)
issues_with_sufficient_comments = []
if response.status_code == 200:
# Extract the JSON data
data = response.json()
for item in data:
issues_with_sufficient_comments.append(item['number'])
print(item['number'])
print(item['comments'])
else:
# Print error message if request failed
print(f"Error: {response.status_code}")
I also tried
url = f”https://api.github.com/repos/{owner}/{repo}/issues?q=comments:>250″, which did not help either
New contributor
kittielover is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.