swh.provenance.api.server module#

class swh.provenance.api.server.ProvenanceServerApp(*args, backend_class=None, backend_factory=None, **kwargs)[source]#

Bases: RPCServerApp

extra_type_decoders: Dict[str, Callable] = {'core_swhid': <bound method _BaseSWHID.from_string of <class 'swh.model.swhids.CoreSWHID'>>, 'extended_swhid': <bound method _BaseSWHID.from_string of <class 'swh.model.swhids.ExtendedSWHID'>>, 'qualified_swhid': <bound method QualifiedSWHID.from_string of <class 'swh.model.swhids.QualifiedSWHID'>>}#

Value of extra_decoders passed to json_loads or msgpack_loads to be able to deserialize more object types.

extra_type_encoders: List[Tuple[type, str, Callable]] = [(<class 'swh.model.swhids.CoreSWHID'>, 'core_swhid', <class 'str'>), (<class 'swh.model.swhids.ExtendedSWHID'>, 'extended_swhid', <class 'str'>), (<class 'swh.model.swhids.QualifiedSWHID'>, 'qualified_swhid', <class 'str'>)]#

Value of extra_encoders passed to json_dumps or msgpack_dumps to be able to serialize more object types.

swh.provenance.api.server.search_error_handler(exception)[source]#
swh.provenance.api.server.my_error_handler(exception)[source]#
swh.provenance.api.server.index()[source]#
swh.provenance.api.server.load_and_check_config(config_file: str) Dict[str, Any][source]#
Check the minimal configuration is set to run the api or raise an

error explanation.

Parameters:
  • config_file – Path to the configuration file to load

  • type – configuration type. For ‘local’ type, more checks are done.

Raises:

Error if the setup is not as expected

Returns:

configuration as a dict

swh.provenance.api.server.make_app_from_configfile()[source]#

Run the WSGI app from the webserver, loading the configuration from a configuration file.

SWH_CONFIG_FILENAME environment variable defines the configuration path to load.