관리-도구
편집 파일: sessions.cpython-38.pyc
U &?�fw � @ sl d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z ddl mZ ddlm Z dd lmZmZmZmZ dd lmZmZmZmZ ddlmZmZmZmZ ddlmZmZ dd l m!Z!m"Z"m#Z#m$Z$ ddl%m&Z& ddl'm(Z( ddl)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3 ej4dk�r$ej5Z6nejZ6efdd�Z7efdd�Z8G dd� d�Z9G dd� de9�Z:dd� Z;dS )z� requests.sessions ~~~~~~~~~~~~~~~~~ This module provides a Session object to manage and persist settings across requests (cookies, auth, proxies). � N)�OrderedDict)� timedelta� )�to_native_string)�HTTPAdapter)�_basic_auth_str)�Mapping� cookielib�urljoin�urlparse)�RequestsCookieJar�cookiejar_from_dict�extract_cookies_to_jar� merge_cookies)�ChunkedEncodingError�ContentDecodingError� InvalidSchema�TooManyRedirects)� default_hooks� dispatch_hook)�DEFAULT_REDIRECT_LIMIT�REDIRECT_STATI�PreparedRequest�Request)�codes)�CaseInsensitiveDict) � DEFAULT_PORTS�default_headers�get_auth_from_url�get_environ_proxies�get_netrc_auth�requote_uri�resolve_proxies�rewind_body�should_bypass_proxies�to_key_val_list�win32c C sp |dkr| S | dkr|S t |t�r,t | t�s0| S |t|��}|�t| �� dd� |�� D �}|D ] }||= q`|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 S s g | ]\}}|d kr|�qS �N� )�.0�k�vr( r( �K/opt/hc_python/lib/python3.8/site-packages/pip/_vendor/requests/sessions.py� <listcomp>T s z!merge_setting.<locals>.<listcomp>)� isinstancer r% �update�items)�request_setting�session_setting� dict_class�merged_setting� none_keys�keyr( r( r, � merge_setting= s ��r7 c C s@ |dks|� d�g kr| S | dks0| � d�g kr4|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)�getr7 )� request_hooks� session_hooksr3 r( r( r, �merge_hooks[ s r<