PyGithub Programming Model: Difference between revisions
Jump to navigation
Jump to search
Line 5: | Line 5: | ||
==Authentication with Personal Access Token (PAT)== | ==Authentication with Personal Access Token (PAT)== | ||
<syntaxhighlight lang='py'> | <syntaxhighlight lang='py'> | ||
github_pat = os.environ.get('GITHUB_PAT') | |||
if not github_pat: | |||
raise ValueError("'GITHUB_PAT' not found in environment") | |||
host_url = 'https://github.pie.apple.com' | |||
api_endpoint = 'api/v3' | |||
base_url = f'{host_url}/{api_endpoint}' | |||
github = Github(base_url=f'{base_url}', login_or_token=github_pat) | |||
</syntaxhighlight> | |||
==Authentication with Username and Password== | ==Authentication with Username and Password== | ||
==Authentication with JWT== | ==Authentication with JWT== | ||
=Configuring Retry= | =Configuring Retry= |
Revision as of 23:31, 15 May 2023
Internal
Authentication
Various authentication mechanism are invoked by appropriately configuring the main Github
class.
Authentication with Personal Access Token (PAT)
github_pat = os.environ.get('GITHUB_PAT')
if not github_pat:
raise ValueError("'GITHUB_PAT' not found in environment")
host_url = 'https://github.pie.apple.com'
api_endpoint = 'api/v3'
base_url = f'{host_url}/{api_endpoint}'
github = Github(base_url=f'{base_url}', login_or_token=github_pat)