AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/requests_toolbelt/auth/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /usr/lib/python3/dist-packages/requests_toolbelt/auth/__pycache__/handler.cpython-310.pyc
o

�ˀX8�@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|�|_|��dS�N)�dict�
strategies�
_make_uniform)�selfr	�r�@/usr/lib/python3/dist-packages/requests_toolbelt/auth/handler.py�__init__6s
zAuthHandler.__init__cCs|�|j�}||�Sr)�get_strategy_for�url)r�request�authrrr
�__call__:szAuthHandler.__call__cCsd�|j�S)Nz<AuthHandler({0!r})>)�formatr	�rrrr
�__repr__>szAuthHandler.__repr__cCs2t|j���}i|_|D]
\}}|�||�qdSr)�listr	�items�add_strategy)r�existing_strategies�k�vrrr
r
As
�zAuthHandler._make_uniformcCs(t|�}t|j��|j��ddddf�S)N�)rr�scheme�lower�netloc)r�parsedrrr
�
_key_from_urlHs

�zAuthHandler._key_from_urlcCs*t|t�r	t|�}|�|�}||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�tuplerr"r	)r�domain�strategy�keyrrr
rOs

zAuthHandler.add_strategycCs|�|�}|j�|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)

        )r"r	�get�NullAuthStrategy)rrr'rrr
res
zAuthHandler.get_strategy_forcCs$|�|�}||jvr|j|=dSdS)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)r"r	)rr%r'rrr
�remove_strategyws

�zAuthHandler.remove_strategyN)
�__name__�
__module__�__qualname__�__doc__rrrr
�staticmethodr"rrr*rrrr
rs%
rc@seZdZdd�Zdd�ZdS)r)cCsdS)Nz<NullAuthStrategy>rrrrr
r��zNullAuthStrategy.__repr__cCs|Srr)r�rrrr
r�r0zNullAuthStrategy.__call__N)r+r,r-rrrrrr
r)�sr)N)	r.�
requests.authrr�requests.compatrrrr)rrrr
�<module>s
	z

Anon7 - 2022
AnonSec Team