1 # -*- coding: utf-8 -*-
7 This module provides the capabilities for the Requests hooks system.
12 The response generated from a Request.
26 # TODO: response is the only one
29 def dispatch_hook(key
, hooks
, hook_data
, **kwargs
):
30 """Dispatches a hook dictionary on a given piece of data."""
32 hooks
= hooks
or dict()
35 hooks
= hooks
.get(key
)
37 if hasattr(hooks
, '__call__'):
41 _hook_data
= hook(hook_data
, **kwargs
)
42 if _hook_data
is not None:
43 hook_data
= _hook_data