swh.web.common.origin_visits module

swh.web.common.origin_visits.get_origin_visits(origin_info: swh.web.common.typing.OriginInfo) → List[swh.web.common.typing.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.

Parameters

origin_info – dict describing the origin to fetch visits from

Returns

A list of dict describing the origin visits

Raises

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

swh.web.common.origin_visits.get_origin_visit(origin_info: swh.web.common.typing.OriginInfo, visit_ts: Optional[Union[int, str]] = None, visit_id: Optional[int] = None, snapshot_id: Optional[str] = None)swh.web.common.typing.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.

Parameters
  • origin_info – a dict filled with origin information

  • visit_ts – an ISO date string or Unix timestamp to parse

  • snapshot_id – a snapshot identifier

Returns

A dict containing the visit info.

Raises

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