(urir, datetime)
return (new_datetime, link_header, uri)
Request a URI-R at a supplied datetime from the CDXJ
Request a URI-R at a supplied datetime from the CDXJ
Request a URI - R at a supplied datetime from the CDXJ
def resolve_memento(urir, datetime):
    """ Request a URI-R at a supplied datetime from the CDXJ """
    if ipwb_utils.is_localhosty(urir):
        urir = urir.split('/', 4)[4]
    s = surt.surt(urir, path_strip_trailing_slash_unless_empty=False)
    index_path = ipwb_utils.get_ipwb_replay_index_path()

    print(f'Getting CDXJ lines with the URI-R {urir} from {index_path}')
    cdxj_lines_with_urir = get_cdxj_lines_with_urir(urir, index_path)

    closest_line = get_cdxj_line_closest_to(datetime, cdxj_lines_with_urir)

    if closest_line is None:
        msg = '<h1>ERROR 404</h1>'
        msg += f'<p>No captures found for {urir} at {datetime}.</p>'

        return Response(msg, status=404)

    uri = unsurt(closest_line.split(' ')[0])
    new_datetime = closest_line.split(' ')[1]

    link_header = get_link_header_abbreviated_timemap(urir, new_datetime)

    return (new_datetime, link_header, uri)
def resolve_memento ( urir , datetime ) : if ipwb_utils . is_localhosty ( urir ) : urir = urir . split ( '/' , 4 ) [ 4 ] s = surt . surt ( urir , path_strip_trailing_slash_unless_empty = False ) index_path = ipwb_utils . get_ipwb_replay_index_path ( ) print ( f'Getting CDXJ lines with the URI-R {urir} from {index_path}' ) cdxj_lines_with_urir = get_cdxj_lines_with_urir ( urir , index_path ) closest_line = get_cdxj_line_closest_to ( datetime , cdxj_lines_with_urir ) if closest_line is None : msg = '<h1>ERROR 404</h1>' msg += f'<p>No captures found for {urir} at {datetime}.</p>' return Response ( msg , status = 404 ) uri = unsurt ( closest_line . split ( ' ' ) [ 0 ] ) new_datetime = closest_line . split ( ' ' ) [ 1 ] link_header = get_link_header_abbreviated_timemap ( urir , new_datetime ) return ( new_datetime , link_header , uri )