MCPcopy Create free account
hub / github.com/HKUDS/AutoAgent / __init__

Method __init__

autoagent/tools/github_client.py:9–25  ·  view source on GitHub ↗

Initialize the GitHub client Args: token: GitHub Personal Access Token, if None, try to get from environment variable

(self, token: Optional[str] = None)

Source from the content-addressed store, hash-verified

7 """GitHub operation client"""
8
9 def __init__(self, token: Optional[str] = None):
10 """
11 Initialize the GitHub client
12
13 Args:
14 token: GitHub Personal Access Token, if None, try to get from environment variable
15 """
16 self.token = token or os.getenv('GITHUB_AI_TOKEN')
17 if not self.token:
18 raise ValueError("GitHub Token is required, please provide it via the token parameter or set the GITHUB_AI_TOKEN environment variable.")
19
20 self.session = requests.Session()
21 self.session.headers.update({
22 'Authorization': f'token {self.token}',
23 'Accept': 'application/vnd.github.v3+json'
24 })
25 self.api_base = 'https://api.github.com'
26
27 def check_auth(self) -> dict:
28 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected