o
    ãË·e2  ã                   @   sH   d dl mZ d dlmZmZ d dlmZmZmZ d	dd„Z	d	dd„Z
dS )
é    )ÚmkFilter)ÚdiscoverÚDiscoveryFailure)Ú	parseXRDSÚiterServicesÚ	XRDSErrorNc              
   C   sN   t | ƒ}z
t|j|j|ƒ}W n ty! } ztt|ƒdƒ‚d}~ww |j|fS )at  Perform the Yadis protocol on the input URL and return an
    iterable of resulting endpoint objects.

    @param flt: A filter object or something that is convertable to
        a filter object (using mkFilter) that will be used to generate
        endpoint objects. This defaults to generating BasicEndpoint
        objects.

    @param input_url: The URL on which to perform the Yadis protocol

    @return: The normalized identity URL and an iterable of endpoint
        objects generated by the filter function.

    @rtype: (str, [endpoint])

    @raises DiscoveryFailure: when Yadis fails to obtain an XRDS document.
    N)r   ÚapplyFilterÚnormalized_uriÚresponse_textr   r   Ústr)Ú	input_urlÚfltÚresultÚ	endpointsÚerr© r   úL/var/www/ideatree/venv/lib/python3.10/site-packages/openid/yadis/services.pyÚgetServiceEndpoints   s   
ÿ€ÿ
r   c                 C   s8   t |ƒ}t|ƒ}g }t|ƒD ]}| | | |¡¡ q|S )aa  Generate an iterable of endpoint objects given this input data,
    presumably from the result of performing the Yadis protocol.

    @param normalized_uri: The input URL, after following redirects,
        as in the Yadis protocol.


    @param xrd_data: The XML text the XRDS file fetched from the
        normalized URI.
    @type xrd_data: str

    )r   r   r   Úextendr   )r	   Úxrd_datar   Úetr   Úservice_elementr   r   r   r   #   s   
ÿr   )N)Úopenid.yadis.filtersr   Úopenid.yadis.discoverr   r   Úopenid.yadis.etxrdr   r   r   r   r   r   r   r   r   Ú<module>   s
   
