관리-도구
편집 파일: sessions.cpython-311.pyc
� R�Dg�u � �� � d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z ddl mZmZm Z mZmZ ddlmZmZmZmZ dd lmZmZmZ dd lmZmZ ddlmZ ddlmZm Z m!Z! dd l"m#Z#m$Z$m%Z%m&Z& ddl'm(Z( ddl)m*Z* ddlm+Z+m,Z,m-Z-m.Z.m/Z/m0Z0 ddl1m2Z2 ddlm3Z3 ej4 dk r ej5 Z6n# e7$ r ej8 Z6Y nw xY wej Z6efd�Z9efd�Z: G d� de;� � Z< G d� de<� � Z=d� Z>dS )z� requests.sessions ~~~~~~~~~~~~~~~~~ This module provides a Session object to manage and persist settings across requests (cookies, auth, proxies). � N)� timedelta)�OrderedDict� )�_basic_auth_str)� cookielib�is_py3�urljoin�urlparse�Mapping)�cookiejar_from_dict�extract_cookies_to_jar�RequestsCookieJar� merge_cookies)�Request�PreparedRequest�DEFAULT_REDIRECT_LIMIT)� default_hooks� dispatch_hook)�to_native_string)�to_key_val_list�default_headers� DEFAULT_PORTS)�TooManyRedirects� InvalidSchema�ChunkedEncodingError�ContentDecodingError)�CaseInsensitiveDict)�HTTPAdapter)�requote_uri�get_environ_proxies�get_netrc_auth�should_bypass_proxies�get_auth_from_url�rewind_body)�codes)�REDIRECT_STATI�win32c �. � |�| S | �|S t |t � � rt | t � � s| S |t |� � � � }|� t | � � � � d� |� � � D � � }|D ]}||= �|S )z�Determines appropriate setting for a given request, taking into account the explicit setting on that request, and the setting in the session. If a setting is a dictionary, they will be merged together using `dict_class` Nc � � g | ] \ }}|�|�� S �N� )�.0�k�vs �q/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib/python3.11/site-packages/requests/sessions.py� <listcomp>z!merge_setting.<locals>.<listcomp>J s � �E�E�E�v��1�1�9��9�9�9� )� isinstancer r �update�items)�request_setting�session_setting� dict_class�merged_setting� none_keys�keys r/ � merge_settingr; 2 s� � � �������� ���0�0�����0�0�� ���Z��� @� @�A�A�N����/�/�:�:�;�;�;� F�E��!5�!5�!7�!7�E�E�E�I�� � ���3����r1 c � � |�|� d� � g k r| S | �| � d� � g k r|S t | ||� � S )z�Properly merges both requests and session hooks. This is necessary because when request_hooks == {'response': []}, the merge breaks Session hooks entirely. N�response)�getr; )� request_hooks� session_hooksr7 s r/ �merge_hooksrA Q s^ � � �� � 1� 1�*� =� =�� C� C����� � 1� 1�*� =� =�� C� C����� �z�B�B�Br1 c �8 � e Zd Zd� Zd� Z d d�Zd� Zd� Zd � ZdS )�SessionRedirectMixinc � � |j r9|j d }t r|� d� � }t |d� � S dS )z7Receives a Response. Returns a redirect URI or ``None``�location�latin1�utf8N)�is_redirect�headersr �encoder )�self�resprE s r/ �get_redirect_targetz(SessionRedirectMixin.get_redirect_targetb sK � � �� 6��|�J�/�H� � 5�#�?�?�8�4�4��#�H�f�5�5�5��tr1 c �b � t |� � }t |� � }|j |j k rdS |j dk r|j dv r|j dk r|j dv rdS |j |j k }|j |j k }t j |j d� � df}|s|j |v r|j |v rdS |p|S )zFDecide whether Authorization header should be removed when redirectingT�http)�P N�https)i� NFN)r �hostname�scheme�portr r>