
    h                         S r SSKJr  SSKJrJr  SSKJrJrJ	r	   " S S5      r
\" \R                  5       " S S\R                  5      5       rg	)
z
Lookup a name using multiple resolvers.

Future Plans: This needs someway to specify which resolver answered
the query, or someway to specify (authority|ttl|cache behavior|more?)
    )implementer)defer
interfaces)commondnserrorc                        \ rS rSrS rS rSrg)FailureHandler   c                 (    Xl         X l        X0l        g N)resolverquerytimeout)selfr   r   r   s       \/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/twisted/names/resolve.py__init__FailureHandler.__init__   s     
    c                     UR                  [        R                  [        R                  [
        5        U R                  U R                  U R                  5      $ r   )	trapr   DomainErrorr   TimeoutErrorNotImplementedErrorr   r   r   )r   failures     r   __call__FailureHandler.__call__   s6    S__e&8&8:MN}}TZZ66r   )r   r   r   N)__name__
__module____qualname____firstlineno__r   r   __static_attributes__ r   r   r
   r
      s    
7r   r
   c                   .    \ rS rSrSrS rS rSS jrSrg)	ResolverChain   z0
Lookup an address using multiple L{IResolver}s
c                 N    [         R                  R                  U 5        Xl        g)zQ
@type resolvers: L{list}
@param resolvers: A L{list} of L{IResolver} providers.
N)r   ResolverBaser   	resolvers)r   r)   s     r   r   ResolverChain.__init__%   s    
 	$$T*"r   c                 Z   U R                   (       d)  [        R                  " [        R                  " 5       5      $ [
        R                  " XU5      nU R                   S   R                  XT5      nU R                   SS  H(  nUR                  [        UR                  XT5      5      nM*     U$ )a  
Build a L{dns.Query} for the given parameters and dispatch it
to each L{IResolver} in C{self.resolvers} until an answer or
L{error.AuthoritativeDomainError} is returned.

@type name: C{str}
@param name: DNS name to resolve.

@type type: C{int}
@param type: DNS record type.

@type cls: C{int}
@param cls: DNS record class.

@type timeout: Sequence of C{int}
@param timeout: Number of seconds after which to reissue the query.
    When the last timeout expires, the query is considered failed.

@rtype: L{Deferred}
@return: A L{Deferred} which fires with a three-tuple of lists of
    L{twisted.names.dns.RRHeader} instances.  The first element of the
    tuple gives answers.  The second element of the tuple gives
    authorities.  The third element of the tuple gives additional
    information.  The L{Deferred} may instead fail with one of the
    exceptions defined in L{twisted.names.error} or with
    C{NotImplementedError}.
r      N)
r)   r   failr   r   r   Queryr   
addErrbackr
   )r   nameclstyper   qdrs           r   _lookupResolverChain._lookup-   s    8 ~~::e//122IId#&NN1##A/#A^AGGQ@AA $r   Nc                 ,   U R                   (       d)  [        R                  " [        R                  " 5       5      $ U R                   S   R                  X5      nU R                   SS   H(  nUR                  [        UR
                  X5      5      nM*     U$ )Nr   r,   )r)   r   r-   r   r   lookupAllRecordsr/   r
   )r   r0   r   r4   r5   s        r   r9   ResolverChain.lookupAllRecordsQ   sq    
 ~~::e//122NN1..t=#A^A,>,>NOA $r   )r)   r   )	r   r   r    r!   __doc__r   r6   r9   r"   r#   r   r   r%   r%      s    #"H
r   r%   N)r;   zope.interfacer   twisted.internetr   r   twisted.namesr   r   r   r
   	IResolverr(   r%   r#   r   r   <module>r@      sN   
 ' . , ,	7 	7 Z!!";F'' ; #;r   