Spaces:
Build error
Build error
Download agents/github_agent.py from ashiquzzaman/codepulse-agents: direct link, hf CLI and curl.
- Browser
- Download file 904 Bytes
-
https://huggingface.co/spaces/ashiquzzaman/codepulse-agents/resolve/main/agents/github_agent.py
- Command line
-
hf download hf://spaces/ashiquzzaman/codepulse-agents/agents/github_agent.py
-
curl -L -o github_agent.py https://huggingface.co/spaces/ashiquzzaman/codepulse-agents/resolve/main/agents/github_agent.py
904 Bytes
| import requests | |
| class GitHubAgent: | |
| def __init__(self): | |
| self.repo = "microsoft/vscode" | |
| self.headers = {"Accept": "application/vnd.github.v3+json"} | |
| def get_top_issues(self, label="bug", limit=5): | |
| """Get most commented/recent bug reports""" | |
| url = f"https://api.github.com/repos/{self.repo}/issues" | |
| params = { | |
| "state": "open", | |
| "labels": label, | |
| "per_page": limit, | |
| "sort": "comments", | |
| "direction": "desc" | |
| } | |
| response = requests.get(url, headers=self.headers, params=params) | |
| if response.status_code == 200: | |
| return [{ | |
| "title": issue['title'], | |
| "comments": issue['comments'], | |
| "url": issue['html_url'], | |
| "created_at": issue['created_at'] | |
| } for issue in response.json()] | |
| return [] |