Module ogr.services.github.auth_providers.abstract

Classes

class GithubAuthentication

Represents a token manager for authentication via GitHub App.

Expand source code
class GithubAuthentication:
    """
    Represents a token manager for authentication via GitHub App.
    """

    def get_token(self, namespace: str, repo: str) -> str:
        """
        Get a GitHub token for requested repository.

        Args:
            namespace: Namespace of the repository.
            repo: Name of the repository.

        Returns:
            A token that can be used in PyGithub instance for authentication.
        """
        raise NotImplementedError()

    @property
    def pygithub_instance(self) -> "github.Github":
        """
        Returns:
            Generic PyGithub instance. Used for `GitUser` for example.
        """
        raise NotImplementedError()

    @staticmethod
    def try_create(**kwargs) -> Optional["GithubAuthentication"]:
        """
        Tries to construct authentication object from provided keyword arguments.

        Returns:
            `GithubAuthentication` object or `None` if the creation was not
            successful.
        """
        raise NotImplementedError()

Subclasses

Static methods

def try_create(**kwargs) ‑> GithubAuthentication | None

Tries to construct authentication object from provided keyword arguments.

Returns

GithubAuthentication object or None if the creation was not successful.

Instance variables

prop pygithub_instance : github.Github

Returns

Generic PyGithub instance. Used for GitUser for example.

Expand source code
@property
def pygithub_instance(self) -> "github.Github":
    """
    Returns:
        Generic PyGithub instance. Used for `GitUser` for example.
    """
    raise NotImplementedError()

Methods

def get_token(self, namespace: str, repo: str) ‑> str

Get a GitHub token for requested repository.

Args

namespace
Namespace of the repository.
repo
Name of the repository.

Returns

A token that can be used in PyGithub instance for authentication.