hermes.commands.deposit.invenio_rdm

Module Contents

Classes

InvenioRDMClient

A Requests session.

InvenioRDMResolver

IvenioRDMDepositPlugin

Base class that implements the generic deposition workflow.

class hermes.commands.deposit.invenio_rdm.InvenioRDMClient(config, auth_token=None, platform_name=None)

Bases: hermes.commands.deposit.invenio.InvenioClient

A Requests session.

Provides cookie persistence, connection-pooling, and configuration.

Basic Usage:

>>> import requests
>>> s = requests.Session()
>>> s.get('https://httpbin.org/get')
<Response [200]>

Or as a context manager:

>>> with requests.Session() as s:
...     s.get('https://httpbin.org/get')
<Response [200]>
DEFAULT_LICENSES_API_PATH = 'api/vocabularies/licenses'
platform_name = 'invenio_rdm'
get_license(license_id: str)
get_licenses()
class hermes.commands.deposit.invenio_rdm.InvenioRDMResolver(client=None)

Bases: hermes.commands.deposit.invenio.InvenioResolver

invenio_client_class
resolve_license_id(license_url: str | None) dict | None

Deliberately try to resolve the license URL to a valid InvenioRDM license information record from the vocabulary.

First, this method tries to find the license URL in the list of known license vocabulary (which is fetched each time, ouch…).

If the URL is not found (what is pretty probable by now, as CFFConvert produces SPDX-URLs while InvenioRDM still relies on the overhauled opensource.org URLs), the SPDX information record is fetched and all valid cross references are sought for.

Returns:

The vocabulary record that is provided by InvenioRDM.

_search_license_info(_url: str, valid_licenses: dict) dict | None
class hermes.commands.deposit.invenio_rdm.IvenioRDMDepositPlugin(command: hermes.commands.deposit.base.HermesDepositCommand, ctx: hermes.model.context.CodeMetaContext, client=None, resolver=None)

Bases: hermes.commands.deposit.invenio.InvenioDepositPlugin

Base class that implements the generic deposition workflow.

TODO: describe workflow… needs refactoring to be less stateful!

platform_name = 'invenio_rdm'
invenio_client_class
invenio_resolver_class