Files
OpenHands/openhands/server/services/github_service.py
2025-01-28 13:14:32 +00:00

17 lines
419 B
Python

import requests
class GitHubService:
def __init__(self, token: str):
self.token = token
self.headers = {
'Authorization': f'Bearer {token}',
'Accept': 'application/vnd.github.v3+json',
}
def get_user(self):
response = requests.get('https://api.github.com/user', headers=self.headers)
response.raise_for_status()
return response.json()