swh.web.utils.citation module#
- swh.web.utils.citation.get_citation_from_origin(format: CitationFormat, origin_url: str) Citation[source]#
Get citation in the requested format given a software origin, from found intrinsic citation 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:
the software citation in the requested format
- 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.citation.get_citation_from_swhid(format: CitationFormat, target_swhid: str) Citation[source]#
Get citation in requested format given a SWHID, from found intrinsic citation metadata in the repository, i.e. original codemeta.json and citation.cff, for the target object.
- Parameters:
target_swhid – SWHID which can be qualified or not, if the target object is of type Content, it must be qualified with an anchor
- Returns:
the software citation in the requested format
- 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