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: ClientSession)[source]#

Bases: object

Manage requests to the Software Heritage Web API.

async get_origin(swhid: CoreSWHID) Any | None[source]#

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

async known(swhids: List[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