File: //usr/local/lib/python3.10/dist-packages/requests/__pycache__/sessions.cpython-310.pyc
o
;��gw � @ sj 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 ej4dkr�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 |du r| S | du r|S t |t�rt | t�s| S |t|��}|�t| �� dd� |�� D �}|D ]}||= q0|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 u r|�qS �N� )�.0�k�vr( r( �</usr/local/lib/python3.10/dist-packages/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@ |du s|� d�g kr
| S | du s| � d�g kr|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<