Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._vendor.requests.sessions Namespace Reference

Data Structures

class  Session
 
class  SessionRedirectMixin
 

Functions

 merge_setting (request_setting, session_setting, dict_class=OrderedDict)
 
 merge_hooks (request_hooks, session_hooks, dict_class=OrderedDict)
 
 session ()
 

Variables

 preferred_clock = time.perf_counter
 

Detailed Description

requests.sessions
~~~~~~~~~~~~~~~~~

This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).

Function Documentation

◆ merge_hooks()

merge_hooks (   request_hooks,
  session_hooks,
  dict_class = OrderedDict 
)
Properly merges both requests and session hooks.

This is necessary because when request_hooks == {'response': []}, the
merge breaks Session hooks entirely.

Definition at line 91 of file sessions.py.

91def merge_hooks(request_hooks, session_hooks, dict_class=OrderedDict):
92 """Properly merges both requests and session hooks.
93
94 This is necessary because when request_hooks == {'response': []}, the
95 merge breaks Session hooks entirely.
96 """
97 if session_hooks is None or session_hooks.get("response") == []:
98 return request_hooks
99
100 if request_hooks is None or request_hooks.get("response") == []:
101 return session_hooks
102
103 return merge_setting(request_hooks, session_hooks, dict_class)
104
105
for i

References i, and pip._vendor.requests.sessions.merge_setting().

Referenced by Session.prepare_request().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ merge_setting()

merge_setting (   request_setting,
  session_setting,
  dict_class = OrderedDict 
)
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`

Definition at line 61 of file sessions.py.

61def merge_setting(request_setting, session_setting, dict_class=OrderedDict):
62 """Determines appropriate setting for a given request, taking into account
63 the explicit setting on that request, and the setting in the session. If a
64 setting is a dictionary, they will be merged together using `dict_class`
65 """
66
67 if session_setting is None:
68 return request_setting
69
70 if request_setting is None:
71 return session_setting
72
73 # Bypass if not a dictionary (e.g. verify)
74 if not (
75 isinstance(session_setting, Mapping) and isinstance(request_setting, Mapping)
76 ):
77 return request_setting
78
79 merged_setting = dict_class(to_key_val_list(session_setting))
80 merged_setting.update(to_key_val_list(request_setting))
81
82 # Remove keys that are set to None. Extract keys first to avoid altering
83 # the dictionary during iteration.
84 none_keys = [k for (k, v) in merged_setting.items() if v is None]
85 for key in none_keys:
86 del merged_setting[key]
87
88 return merged_setting
89
90

References i.

Referenced by Session.merge_environment_settings(), pip._vendor.requests.sessions.merge_hooks(), and Session.prepare_request().

Here is the caller graph for this function:

◆ session()

session ( )
Returns a :class:`Session` for context-management.

.. deprecated:: 1.0.0

    This method has been deprecated since version 1.0.0 and is only kept for
    backwards compatibility. New code should use :class:`~requests.sessions.Session`
    to create a session. This may be removed at a future date.

:rtype: Session

Definition at line 821 of file sessions.py.

821def session():
822 """
823 Returns a :class:`Session` for context-management.
824
825 .. deprecated:: 1.0.0
826
827 This method has been deprecated since version 1.0.0 and is only kept for
828 backwards compatibility. New code should use :class:`~requests.sessions.Session`
829 to create a session. This may be removed at a future date.
830
831 :rtype: Session
832 """
833 return Session()

Variable Documentation

◆ preferred_clock

preferred_clock = time.perf_counter

Definition at line 56 of file sessions.py.

Referenced by Session.send().