mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-01-21 02:13:01 -08:00
af1aed0b6b
* Bump requests from 2.27.1 to 2.28.1 Bumps [requests](https://github.com/psf/requests) from 2.27.1 to 2.28.1. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.27.1...v2.28.1) --- updated-dependencies: - dependency-name: requests dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update requests==2.28.1 * Update urllib3==1.26.12 * Update certifi==2022.9.24 * Update idna==3.4 * Update charset-normalizer==2.1.1 Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
34 lines
733 B
Python
34 lines
733 B
Python
"""
|
|
requests.hooks
|
|
~~~~~~~~~~~~~~
|
|
|
|
This module provides the capabilities for the Requests hooks system.
|
|
|
|
Available hooks:
|
|
|
|
``response``:
|
|
The response generated from a Request.
|
|
"""
|
|
HOOKS = ["response"]
|
|
|
|
|
|
def default_hooks():
|
|
return {event: [] for event in HOOKS}
|
|
|
|
|
|
# TODO: response is the only one
|
|
|
|
|
|
def dispatch_hook(key, hooks, hook_data, **kwargs):
|
|
"""Dispatches a hook dictionary on a given piece of data."""
|
|
hooks = hooks or {}
|
|
hooks = hooks.get(key)
|
|
if hooks:
|
|
if hasattr(hooks, "__call__"):
|
|
hooks = [hooks]
|
|
for hook in hooks:
|
|
_hook_data = hook(hook_data, **kwargs)
|
|
if _hook_data is not None:
|
|
hook_data = _hook_data
|
|
return hook_data
|