swh.fuse.backends.web_api module#
- class swh.fuse.backends.web_api.WebApiBackend(conf: Dict, cache: FuseCache)[source]#
Bases:
GraphBackend,ContentBackendA Backend querying everything via Software Heritage’s public API.
This is simpler to configure and deploy, but expect long response times.
It gets a pointer to the cache because some endpoints are more verbose than needed, but it allows to pre-cache data for further use. That’s not elegant, but can avoid being rate-limited because of a simple ls archive/rev…/history .
Only needs the
web-apikey ofconf, searching forurland maybeauth-tokenkeys.- async get_metadata(swhid: CoreSWHID) Dict | List[source]#
Entries in the returned
dictdepend on theswhidtype.For
cnt, return a dict containing at leastlength(int).For
dir, return a list of entries like{ "dir_id": "dir's hash", "name": "dir item name", "type": "str=dir|file|rev", # yes, `file`... "target": "target hash", "perms": "permissions [int]", # if target is a cnt: "length": "file size [int]", }
For
rev, return a dict containing at leastdirectory(SWHID),parents(list of objects containing at leastid(hash)),date(str, isoformat),committer_date(str, isoformat),id(object’s hash).For
rel, return a dict containing at leasttarget(SWHID),target_type,date(str, isoformat),id(object’s hash).For
snp, return a dict where each key is a branch name, each value is a dict containing at leasttarget(hash),target_type(content, directory, revision, release, snapshot or alias).