project_config.fetchers.github module

Github files resources URIs fetcher.

class project_config.fetchers.github.AcceptHeader(value)[source]

Bases: Enum

Accept header values for Github API.

JSON = 'application/vnd.github+json'
project_config.fetchers.github._build_github_api_url(repo_owner: str, repo_name: str, git_reference: str | None, fpath: str) str[source]
project_config.fetchers.github._github_headers(accept: Optional[AcceptHeader] = None) dict[str, str][source]
project_config.fetchers.github.fetch(url_parts: SplitResult, **kwargs: Any) Any[source]

Fetch a resource through HTTPs protocol for a Github URI.

Parameters:
  • url_parts (urllib.parse.SplitResult) – The URL parts of the URI.

  • **kwargs (Any) – The keyword arguments to pass to the GET function.

Returns:

The fetched resource content.

Return type:

str

project_config.fetchers.github.get_latest_release_tags(repo_owner: str, repo_name: str, only_semver: bool = False) list[str][source]

Get the latest release tag of a Github repository.

Parameters:
  • repo_owner (str) – The Github repository owner.

  • repo_name (str) – The Github repository name.

  • only_semver (bool) – If True, only return a tag if it is a semver tag.

Returns:

The latest release tag.

Return type:

str

project_config.fetchers.github.resolve_url(url_parts: SplitResult) str[source]

Resolve a gh: scheme URI to their real counterpart.

Parameters:

url_parts (urllib.parse.SplitResult) – The URL parts of the URI.

Returns:

The real https: scheme URL.

Return type:

str