PyGithub Concepts: Difference between revisions
Jump to navigation
Jump to search
(→Github) |
(→Github) |
||
Line 4: | Line 4: | ||
=<tt>Github</tt>= | =<tt>Github</tt>= | ||
{{External|https://pygithub.readthedocs.io/en/latest/github.html}} | {{External|https://pygithub.readthedocs.io/en/latest/github.html}} | ||
The main class to instantiate to access the GitHub API. It is used to configure authentication, via [[PyGithub_Programming_Model#Authentication_with_Username_and_Password|username and password]], [[PyGithub_Programming_Model#Authentication_with_Personal_Access_Token_.28PAT.29|personal access token (PAT)]] or [[PyGithub_Programming_Model#Authentication_with_JWT|JWT]], the base URL, the timeout, the user agent, the Retry strategy and the pool size. | The main class to instantiate to access the GitHub API. It is used to configure authentication, via [[PyGithub_Programming_Model#Authentication_with_Username_and_Password|username and password]], [[PyGithub_Programming_Model#Authentication_with_Personal_Access_Token_.28PAT.29|personal access token (PAT)]] or [[PyGithub_Programming_Model#Authentication_with_JWT|JWT]], the [[#Base_URL|base URL]], the timeout, the user agent, the Retry strategy and the pool size. | ||
==Base URL== | ==Base URL== | ||
The <code>base_url</code> consists of the host URL and API endpoint: | The <code>base_url</code> consists of the host URL and API endpoint: |
Revision as of 23:37, 15 May 2023
Internal
Github
The main class to instantiate to access the GitHub API. It is used to configure authentication, via username and password, personal access token (PAT) or JWT, the base URL, the timeout, the user agent, the Retry strategy and the pool size.
Base URL
The base_url
consists of the host URL and API endpoint:
host_url = 'https://github.com'
api_endpoint = 'api/v3'
base_url = f'{host_url}/{api_endpoint}'
github = Github(base_url=f'{base_url}', ...)
Authentication
- Authentication with Personal Access Token (PAT)
- Authentication with Username and Password
- Authentication with JWT
Authenticated SSL Client
If the Github server requires the client to authenticate, and the client does not, or uses a self-signed certificate, an invocation fails with:
requests.exceptions.SSLError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /api/v3/user/repos?per_page=100 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)')))