Server IP : 209.38.156.173 / Your IP : 216.73.216.122 [ 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 : /lib/python3/dist-packages/requests_toolbelt/auth/__pycache__/ |
Upload File : |
o �ˀX8 � @ sH d Z ddlmZmZ ddlmZmZ G dd� de�ZG dd� de�ZdS ) z� requests_toolbelt.auth.handler ============================== This holds all of the implementation details of the Authentication Handler. � )�AuthBase� HTTPBasicAuth)�urlparse� urlunparsec @ sT e Zd ZdZdd� Zdd� Zdd� Zdd � Zed d� �Z dd � Z dd� Zdd� ZdS )�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. c C s t |�| _| �� d S �N)�dict� strategies� _make_uniform)�selfr � r �@/usr/lib/python3/dist-packages/requests_toolbelt/auth/handler.py�__init__6 s zAuthHandler.__init__c C s | � |j�}||�S r )�get_strategy_for�url)r �request�authr r r �__call__: s zAuthHandler.__call__c C s d� | j�S )Nz<AuthHandler({0!r})>)�formatr �r r r r �__repr__>