Exemple #1
0
def lazy_cdx_load(**params):
    """
    # Verify that an op 'short-circuits' further evaluation.. eg, a bad cdx source is not even loaded
    # as soon as exception is thrown

    Exception is thrown on first .next() access, not on the cdx_load
    """
    params['custom_ops'] = [raise_access_exception]

    cdx_iter = cdx_load(['bogus ignored'], CDXQuery(params), process=True)

    # exception happens on first access attempt
    with raises(AccessException):
        six.next(cdx_iter)
Exemple #2
0
    def _load_cdx_query(self, query):
        """
        load CDX for query parameters ``params``.
        ``key`` (or ``url``) parameter specifies URL to query,
        ``matchType`` parameter specifies matching method for ``key``
        (default ``exact``).
        other parameters are passed down to :func:`cdx_load`.
        raises :exc:`~pywb.utils.wbexception.NotFoundException`
        if no captures are found.

        :param query: query parameters
        :type query: :class:`~pywb.cdx.query.CDXQuery`
        :rtype: iterator on :class:`~pywb.cdx.cdxobject.CDXObject`
        """
        return cdx_load(self.sources, query)
Exemple #3
0
def lazy_cdx_load(**params):
    """
    # Verify that an op 'short-circuits' further evaluation.. eg, a bad cdx source is not even loaded
    # as soon as exception is thrown

    Exception is thrown on first .next() access, not on the cdx_load
    """
    params['custom_ops'] = [raise_access_exception]

    cdx_iter = cdx_load(['bogus ignored'],
                        CDXQuery(params),
                        process=True)

    # exception happens on first access attempt
    with raises(AccessException):
        six.next(cdx_iter)
Exemple #4
0
 def _load_cdx_query(self, query):
     return cdx_load([self.source], query, process=False)