404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.138.137.175: ~ $
3

�P\8�@sHdZddlmZmZddlmZmZGdd�de�ZGdd�de�ZdS)	z�

requests_toolbelt.auth.handler
==============================

This holds all of the implementation details of the Authentication Handler.

�)�AuthBase�
HTTPBasicAuth)�urlparse�
urlunparsec@sTeZdZdZdd�Zdd�Zdd�Zdd	�Zed
d��Z	dd
�Z
dd�Zdd�ZdS)�AuthHandlera�

    The ``AuthHandler`` object takes a dictionary of domains paired with
    authentication strategies and will use this to determine which credentials
    to use when making a request. For example, you could do the following:

    .. code-block:: python

        from requests import HTTPDigestAuth
        from requests_toolbelt.auth.handler import AuthHandler

        import requests

        auth = AuthHandler({
            'https://api.github.com': ('sigmavirus24', 'fakepassword'),
            'https://example.com': HTTPDigestAuth('username', 'password')
        })

        r = requests.get('https://api.github.com/user', auth=auth)
        # => <Response [200]>
        r = requests.get('https://example.com/some/path', auth=auth)
        # => <Response [200]>

        s = requests.Session()
        s.auth = auth
        r = s.get('https://api.github.com/user')
        # => <Response [200]>

    .. warning::

        :class:`requests.auth.HTTPDigestAuth` is not yet thread-safe. If you
        use :class:`AuthHandler` across multiple threads you should
        instantiate a new AuthHandler for each thread with a new
        HTTPDigestAuth instance for each thread.

    cCst|�|_|j�dS)N)�dict�
strategies�
_make_uniform)�selfr�r�/usr/lib/python3.6/handler.py�__init__6s
zAuthHandler.__init__cCs|j|j�}||�S)N)�get_strategy_for�url)r
ZrequestZauthrrr�__call__:szAuthHandler.__call__cCsdj|j�S)Nz<AuthHandler({0!r})>)�formatr)r
rrr�__repr__>szAuthHandler.__repr__cCs6t|jj��}i|_x|D]\}}|j||�qWdS)N)�listr�items�add_strategy)r
Zexisting_strategies�k�vrrrr	AszAuthHandler._make_uniformcCs(t|�}t|jj�|jj�ddddf�S)N�)rr�scheme�lowerZnetloc)rZparsedrrr�
_key_from_urlHs
zAuthHandler._key_from_urlcCs*t|t�rt|�}|j|�}||j|<dS)aAdd a new domain and authentication strategy.

        :param str domain: The domain you wish to match against. For example:
            ``'https://api.github.com'``
        :param str strategy: The authentication strategy you wish to use for
            that domain. For example: ``('username', 'password')`` or
            ``requests.HTTPDigestAuth('username', 'password')``

        .. code-block:: python

            a = AuthHandler({})
            a.add_strategy('https://api.github.com', ('username', 'password'))

        N)�
isinstance�tuplerrr)r
�domainZstrategy�keyrrrrOs

zAuthHandler.add_strategycCs|j|�}|jj|t��S)aRetrieve the authentication strategy for a specified URL.

        :param str url: The full URL you will be making a request against. For
            example, ``'https://api.github.com/user'``
        :returns: Callable that adds authentication to a request.

        .. code-block:: python

            import requests
            a = AuthHandler({'example.com', ('foo', 'bar')})
            strategy = a.get_strategy_for('http://example.com/example')
            assert isinstance(strategy, requests.auth.HTTPBasicAuth)

        )rr�get�NullAuthStrategy)r
rrrrrres
zAuthHandler.get_strategy_forcCs |j|�}||jkr|j|=dS)akRemove the domain and strategy from the collection of strategies.

        :param str domain: The domain you wish remove. For example,
            ``'https://api.github.com'``.

        .. code-block:: python

            a = AuthHandler({'example.com', ('foo', 'bar')})
            a.remove_strategy('example.com')
            assert a.strategies == {}

        N)rr)r
rrrrr�remove_strategyws

zAuthHandler.remove_strategyN)
�__name__�
__module__�__qualname__�__doc__r
rrr	�staticmethodrrrr"rrrrrs%rc@seZdZdd�Zdd�ZdS)r!cCsdS)Nz<NullAuthStrategy>r)r
rrrr�szNullAuthStrategy.__repr__cCs|S)Nr)r
�rrrrr�szNullAuthStrategy.__call__N)r#r$r%rrrrrrr!�sr!N)	r&Z
requests.authrrZrequests.compatrrrr!rrrr�<module>	sz

Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 113 B 0644
__init__.cpython-36.pyc File 113 B 0644
_digest_auth_compat.cpython-36.opt-1.pyc File 1.27 KB 0644
_digest_auth_compat.cpython-36.pyc File 1.27 KB 0644
guess.cpython-36.opt-1.pyc File 4.06 KB 0644
guess.cpython-36.pyc File 4.06 KB 0644
handler.cpython-36.opt-1.pyc File 5.01 KB 0644
handler.cpython-36.pyc File 5.01 KB 0644
http_proxy_digest.cpython-36.opt-1.pyc File 3.09 KB 0644
http_proxy_digest.cpython-36.pyc File 3.09 KB 0644