1 # -*- coding: utf-8 -*-
7 This module provides the capabilities for the Requests hooks system.
12 The response generated from a Request.
18 return dict((event, []) for event in HOOKS)
20 # TODO: response is the only one
23 def dispatch_hook(key, hooks, hook_data, **kwargs):
24 """Dispatches a hook dictionary on a given piece of data."""
25 hooks = hooks or dict()
26 hooks = hooks.get(key)
28 if hasattr(hooks, '__call__'):
31 _hook_data = hook(hook_data, **kwargs)
32 if _hook_data is not None:
33 hook_data = _hook_data