Lines Matching +full:github +full:- +full:token
3 # SPDX-License-Identifier: Apache-2.0
6 Generic GitHub helper routines which may be useful to other scripts.
24 import github
26 def get_github_credentials(ask: bool = True) -> Dict[str, str]:
27 '''Get credentials for constructing a github.Github object.
29 This function tries to get github.com credentials from these
40 api.github.com is rate limited more aggressively than
45 github.Github constructor as **kwargs.
57 auth = nrc.authenticators('github.com')
61 token = os.environ.get('GITHUB_TOKEN')
62 if token:
63 return {'login_or_token': token}
66 print('Missing GitHub credentials:\n'
67 '~/.netrc file not found or has no github.com credentials, '
69 'Please give your GitHub token.',
71 token = getpass.getpass('token: ')
72 return {'login_or_token': token}
76 def get_github_object(ask: bool = True) -> github.Github:
77 '''Get a github.Github object, created with credentials.
81 return github.Github(**get_github_credentials())