swh.scanner.client module

Minimal async web client for the Software Heritage Web API.

This module could be removed when T2635 <https://forge.softwareheritage.org/T2635> is implemented.

class swh.scanner.client.Client(api_url: str, session: aiohttp.client.ClientSession)[source]

Bases: object

Manage requests to the Software Heritage Web API.

async get_origin(swhid: swh.model.swhids.CoreSWHID) Optional[Any][source]

Walk the compressed graph to discover the origin of a given swhid

async known(swhids: List[swh.model.swhids.CoreSWHID]) Dict[str, Dict[str, bool]][source]

API Request to get information about the SoftWare Heritage persistent IDentifiers (SWHIDs) given in input.

Parameters
  • swhids – a list of CoreSWHID instances

  • api_url – url for the API request

Returns

key:

string SWHID searched

value:

value[‘known’] = True if the SWHID is found value[‘known’] = False if the SWHID is not found

Return type

A dictionary with