swh.web.utils.origin_visits module#

swh.web.utils.origin_visits.get_origin_visits(origin_info: OriginInfo, lookup_similar_urls: bool = True) List[OriginVisitInfo][source]#

Function that returns the list of visits for a swh origin. That list is put in cache in order to speedup the navigation in the swh web browse ui.

The returned visits are sorted according to their date in ascending order.

  • origin_info – dict describing the origin to fetch visits from

  • lookup_similar_urls – if True, lookup origin with and without trailing slash in its URL


A list of dict describing the origin visits


swh.web.utils.exc.NotFoundExc – if the origin is not found

swh.web.utils.origin_visits.get_origin_visit(origin_info: OriginInfo, visit_ts: str | None = None, visit_id: int | None = None, snapshot_id: str | None = None) OriginVisitInfo[source]#

Function that returns information about a visit for a given origin.

If a timestamp is provided, the closest visit from that timestamp is returned.

If a snapshot identifier is provided, the first visit with that snapshot is returned.

If no search hints are provided, return the most recent full visit with a valid snapshot or the most recent partial visit with a valid snapshot otherwise.

  • origin_info – a dict filled with origin information

  • visit_ts – an ISO 8601 datetime string to parse

  • snapshot_id – a snapshot identifier


A dict containing the visit info.


swh.web.utils.exc.NotFoundExc – if no visit can be found