GitHubStorage#
- class gafaelfawr.storage.github.GitHubStorage(*, http_client, logger)#
Bases:
objectRetrieve metadata about public repositories and owners from GitHub.
Used by the GitHub project registry to pin the numeric IDs of a repository and its owner when a project is created, and of the owners allowed by a project template. Requests are made without credentials, so only public repositories can be looked up.
- Parameters:
http_client (
AsyncClient) – HTTP client to use to make requests.logger (
BoundLogger) – Logger for diagnostics.
Methods Summary
get_owner(owner)Retrieve metadata about an owner (organization or user).
get_repository(repository)Retrieve metadata about a public repository.
Methods Documentation
- async get_owner(owner)#
Retrieve metadata about an owner (organization or user).
- Parameters:
owner (
str) – Login of the owner.- Returns:
Name of the owner as GitHub reports it and its numeric ID.
- Return type:
- Raises:
GitHubError – Raised if GitHub returned data that could not be parsed.
GitHubWebError – Raised if an HTTP client error occurred trying to talk to GitHub.
UnknownGitHubOwnerError – Raised if no organization or user has that login.
- async get_repository(repository)#
Retrieve metadata about a public repository.
- Parameters:
repository (
str) – Repository asowner/name.- Returns:
Metadata about the repository, including its numeric IDs.
- Return type:
- Raises:
GitHubError – Raised if GitHub returned data that could not be parsed.
GitHubWebError – Raised if an HTTP client error occurred trying to talk to GitHub.
UnknownGitHubRepositoryError – Raised if the repository does not exist or is not public.