X7ROOT File Manager
Current Path:
/opt/hc_python/lib/python3.12/site-packages/requests
opt
/
hc_python
/
lib
/
python3.12
/
site-packages
/
requests
/
??
..
??
__init__.py
(5.78 KB)
??
__pycache__
??
__version__.py
(435 B)
??
_internal_utils.py
(1.51 KB)
??
_types.py
(5.7 KB)
??
adapters.py
(27.41 KB)
??
api.py
(6.98 KB)
??
auth.py
(11.95 KB)
??
certs.py
(430 B)
??
compat.py
(2.41 KB)
??
cookies.py
(21.04 KB)
??
exceptions.py
(4.46 KB)
??
help.py
(4.11 KB)
??
hooks.py
(1.11 KB)
??
models.py
(40.8 KB)
??
packages.py
(904 B)
??
py.typed
(0 B)
??
sessions.py
(33.45 KB)
??
status_codes.py
(4.25 KB)
??
structures.py
(4.04 KB)
??
utils.py
(35.47 KB)
Editing: hooks.py
""" requests.hooks ~~~~~~~~~~~~~~ This module provides the capabilities for the Requests hooks system. Available hooks: ``response``: The response generated from a Request. """ from __future__ import annotations from collections.abc import Callable, Iterable from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from . import _types as _t from .models import Response HOOKS: list[str] = ["response"] def default_hooks() -> dict[str, list[_t.HookType]]: return {event: [] for event in HOOKS} # TODO: response is the only one def dispatch_hook( key: str, hooks: _t.HooksInputType | None, hook_data: Response, **kwargs: Any, ) -> Response: """Dispatches a hook dictionary on a given piece of data.""" hooks_dict = hooks or {} hook_list: Iterable[_t.HookType] | _t.HookType | None = hooks_dict.get(key) if hook_list: if isinstance(hook_list, Callable): hook_list = [hook_list] for hook in hook_list: _hook_data = hook(hook_data, **kwargs) if _hook_data is not None: hook_data = _hook_data return hook_data
Upload File
Create Folder