(self, project_name, cmd)
| 247 | class GitHubAPI(object): |
| 248 | |
| 249 | def __init__(self, project_name, cmd): |
| 250 | self.github_api = ( |
| 251 | f"https://api.github.com/repos/{ORG_NAME}/{project_name}" |
| 252 | ) |
| 253 | |
| 254 | token = None |
| 255 | config = load_configuration() |
| 256 | if "github" in config.sections(): |
| 257 | token = config["github"]["api_token"] |
| 258 | if not token: |
| 259 | token = os.environ.get('GH_TOKEN') |
| 260 | if not token: |
| 261 | token = os.environ.get('ARROW_GITHUB_API_TOKEN') |
| 262 | if token: |
| 263 | print('ARROW_GITHUB_API_TOKEN environment variable is ' |
| 264 | 'deprecated. Use GH_TOKEN environment variable instead.') |
| 265 | if not token: |
| 266 | token = cmd.prompt('Env GH_TOKEN nor ' |
| 267 | 'ARROW_GITHUB_API_TOKEN not set, ' |
| 268 | 'please enter your GitHub API token ' |
| 269 | '(GitHub personal access token):') |
| 270 | headers = { |
| 271 | 'Accept': 'application/vnd.github.v3+json', |
| 272 | 'Authorization': f'token {token}', |
| 273 | } |
| 274 | self.headers = headers |
| 275 | |
| 276 | def get_milestones(self): |
| 277 | return get_json("%s/milestones" % (self.github_api, ), |
nothing calls this directly
no test coverage detected