Hooks

Requests has a hook system that you can use to manipulate parts of the request process along with internal transport hooks.

Check out the [API documentation for Requests_Hooks][requests_hooks] for more information on how to use the hook system.

Available Hooks

Registering Hooks

Note: if you’re doing this in an authentication handler, see the Custom Authentication guide instead.

In order to register your own hooks, you need to instantiate Requests_hooks and pass this in via the ‘hooks’ option.

$hooks = new Requests_Hooks();
$hooks->register('requests.after_request', 'mycallback');

$request = Requests::get('http://httpbin.org/get', array(), array('hooks' => $hooks));