mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
* Support full GitHub app authentication Refactor GithubIntegration class and add test case for app authentication Add permissions and repository properties in InstallationAuthorization Set JWT_EXPIRY=60 by default in GithubIntegration constructor * Modify existing testcases for GithubIntegration as per the framework and add missing tests * Provide installation ID for creating the access token instead of getting the first installation * Add optional permissions support for installation access token * Add lock around app authentication * Keep compatibility for importing GithubIntegration from MainClass * Group app authentication parameters in a class Co-authored-by: Malik Ammar Akbar <malikammar.akbar@pfizer.com> Co-authored-by: Enrico Minack <github@enrico.minack.dev>
35 lines
1.4 KiB
Python
35 lines
1.4 KiB
Python
from typing import Union, Optional, Dict
|
|
|
|
from github.Installation import Installation
|
|
from github.InstallationAuthorization import InstallationAuthorization
|
|
from github.PaginatedList import PaginatedList
|
|
from github.Requester import Requester
|
|
|
|
class GithubIntegration:
|
|
integration_id: Union[int, str] = ...
|
|
private_key: str = ...
|
|
base_url: str = ...
|
|
jwt_expiry: int = ...
|
|
jwt_issued_at: int = ...
|
|
__requester: Requester = ...
|
|
def __init__(
|
|
self,
|
|
integration_id: Union[int, str],
|
|
private_key: str,
|
|
base_url: str = ...,
|
|
jwt_expiry: int = ...,
|
|
jwt_issued_at: int = ...,
|
|
) -> None: ...
|
|
def _get_installed_app(self, url: str) -> Installation: ...
|
|
def _get_headers(self) -> Dict[str, str]: ...
|
|
def create_jwt(self, expiration: int = ...) -> str: ...
|
|
def get_access_token(
|
|
self, installation_id: int, permissions: Optional[Dict[str, str]] = ...
|
|
) -> InstallationAuthorization: ...
|
|
def get_app_installation(self, installation_id: int) -> Installation: ...
|
|
def get_installation(self, owner: str, repo: str) -> Installation: ...
|
|
def get_installations(self) -> PaginatedList[Installation]: ...
|
|
def get_org_installation(self, org: str) -> Installation: ...
|
|
def get_repo_installation(self, owner: str, repo: str) -> Installation: ...
|
|
def get_user_installation(self, username: str) -> Installation: ...
|