Files
requests3/requests/hooks.py
T
Kenneth Reitz d0cb56932c new hooks system
#118
2011-08-16 23:57:44 -04:00

26 lines
426 B
Python

# -*- coding: utf-8 -*-
"""
requests.hooks
~~~~~~~~~~~~~~
This module provides the capabilities for the Requests hooks system.
"""
import warnings
def dispatch_hook(key, hooks, hook_data):
""""""
hooks = hooks or dict()
if key in hooks:
try:
return hooks.get(key).__call__(hook_data) or hook_data
except Exception, why:
warnings.warn(str(why))
return hook_data