????
Current Path : /lib/python3.9/site-packages/requests/__pycache__/ |
Current File : //lib/python3.9/site-packages/requests/__pycache__/sessions.cpython-39.opt-1.pyc |
a /'fzv � @ s� 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 ej4dk�rTz ej5Z6W n e7�yP ej8Z6Y n0 nejZ6efdd�Z9efdd�Z:G dd� de;�Z<G dd� de<�Z=dd� 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 C sp |du r| S | du r|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 u r|�qS �N� )�.0�k�vr( r( �5/usr/lib/python3.9/site-packages/requests/sessions.py� <listcomp>J � z!merge_setting.<locals>.<listcomp>)� isinstancer r �update�items)Zrequest_settingZsession_setting� dict_classZmerged_settingZ none_keys�keyr( r( r, � merge_setting2 s ��r4 c C s@ |du s|� d�g kr| S | du s0| � 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)�getr4 )Z request_hooksZ session_hooksr2 r( r( r, �merge_hooksQ s r7 c @ s>