swh.loader.metadata.github module#

Metadata fetcher for GitHub.

swh.loader.metadata.github.HTTP_ACCEPT = 'application/vnd.github.v3+json'#

HTTP header sent on all API requests to GitHub.

swh.loader.metadata.github.METADATA_FORMAT = 'application/vnd.github.v3+json'#

Value of the format field of produced swh.model.model.RawExtrinsicMetadata objects.

class swh.loader.metadata.github.GitHubMetadataFetcher(origin: Origin, credentials: Dict[str, Dict[str, List[Dict[str, str]]]] | None, lister_name: str, lister_instance_name: str)[source]#

Bases: BaseMetadataFetcher

FETCHER_NAME: str = 'github'#

The config-friendly name of this fetcher, used to retrieve the first level of credentials.

SUPPORTED_LISTERS: Set[str] = {'github'}#

Set of forge types this metadata fetcher supports. The type names are the same as the names used by listers themselves.

Generally, fetchers have a one-to-one matching with listers, in which case this is set of {FETCHER_NAME}.

github_session() GitHubSession[source]#
get_parent_origins() List[Origin][source]#

If the given origin is a “forge fork” (ie. created with the “Fork” button of GitHub-like forges), returns a list of origins it was forked from; closest parent first.