
    qh                     d    S r SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  Sr " S S	\5      rS
 rg)zXRI resolution.
    )	urlencode)fetchers)etxrd)toURINormal)iterServiceszhttp://proxy.xri.net/c                   4    \ rS rSrSr\4S jrSS jrS rSr	g)	ProxyResolver   z5Python interface to a remote XRI proxy resolver.
    c                     Xl         g N	proxy_url)selfr   s     E/var/www/html/env/lib/python3.13/site-packages/openid/yadis/xrires.py__init__ProxyResolver.__init__   s    "    Nc                     [        U5      SS nU R                  U-   nSS0nU(       a  X%S'   OUS==   S-  ss'   [        XE5      nU$ )a  Build a URL to query the proxy resolver.

@param xri: An XRI to resolve.
@type xri: unicode

@param service_type: The service type to resolve, if you desire
    service endpoint selection.  A service type is a URI.
@type service_type: str

@returns: a URL
@returntype: str
   N_xrd_rzapplication/xrds+xml_xrd_tz
;sep=false)r   r   _appendArgs)r   xriservice_typeqxrihxriargsquerys          r   queryURLProxyResolver.queryURL   s]      3#~~$ ,
 )N Nl*ND'r   c                 J   / nSnU H  nU R                  X5      n[        R                  " U5      nUR                  S;  a  M<  [        R
                  " UR                  5      n[        R                  " X5      n[        [        U5      5      n	UR                  U	5        M     XC4$ )ag  Resolve some services for an XRI.

Note: I don't implement any service endpoint selection beyond what
the resolver I'm querying does, so the Services I return may well
include Services that were not of the types you asked for.

May raise fetchers.HTTPFetchingError or L{etxrd.XRDSError} if
the fetching or parsing don't go so well.

@param xri: An XRI to resolve.
@type xri: unicode

@param service_types: A list of services types to query for.  Service
    types are URIs.
@type service_types: list of str

@returns: tuple of (CanonicalID, Service elements)
@returntype: (unicode, list of C{ElementTree.Element}s)
N)      )r   r   fetchstatusr   	parseXRDSbodygetCanonicalIDlistr   extend)
r   r   service_typesservicescanonicalIDr   urlresponseetsome_servicess
             r   r   ProxyResolver.query6   s    * 
 )L--2C~~c*Hj0 /B..s7K b!12MOOM* * $$r   r   r   )
__name__
__module____qualname____firstlineno____doc__DEFAULT_PROXYr   r   r   __static_attributes__ r   r   r	   r	      s     "/ #B+%r   r	   c                     [        US5      (       a)  [        UR                  5       5      nUR                  5         [	        U5      S:X  a  U $ SU R                  S5      ;   a  SnOSnU < U< [        U5      < 3$ )z,Append some arguments to an HTTP query.
    itemsr   ?&)hasattrr)   r<   sortlenrstripr   )r.   r   seps      r   r   r   d   sg     tWDJJL!		
4yA~
 cjjoC411r   N)r7   urllib.parser   openidr   openid.yadisr   openid.yadis.xrir   openid.yadis.servicesr   r8   objectr	   r   r:   r   r   <module>rJ      s4    #   ( .'S%F S%l2r   