swh.web.utils.metadata module#
- swh.web.utils.metadata.get_bibtex_from_origin(origin_url: str) str [source]#
Get citation in BibTeX format given a software origin, from found raw intrinsic metadata in the repository, i.e. original codemeta.json and citation.cff, for the latest visit snapshot main branch root directory.
- Parameters:
origin_url – origin url
- Returns:
it contains at least an entry type and an entry key)
- Return type:
The software citation in BibTeX format (cannot be empty
- Raises:
swh.web.utils.exc.NotFoundExc – when snapshot, branch or directory is missing, no metadata could be found or the metadata files could not be decoded.
BadInputExc – when the origin does not allow to find metadata.
- swh.web.utils.metadata.get_bibtex_from_swhid(target_swhid: str) str [source]#
Get citation in BibTeX format given a SWHID, from found raw intrinsic metadata in the repository, i.e. original codemeta.json and citation.cff, for the target object.
- Parameters:
target_swhid – SWHID which target object cannot be of type Content and which can
no (be qualified or)
- Returns:
it contains at least an entry type and an entry key)
- Return type:
The software citation in BibTeX format (cannot be empty
- Raises:
swh.web.utils.exc.NotFoundExc – when snapshot, branch or directory is missing, no metadata could be found or the metadata files could not be decoded.
BadInputExc – when the origin does not allow to find metadata.