title: Can python requests have hooks per sessions or global hooks?
body: <p>I have a plan to use <a href="https://github.com/shellycloud/forwardmachine" rel="nofollow">https://github.com/shellycloud/forwardmachine</a></p>
  
  <p>And I want to use requests to contact those servers that were forwarded
  I thought of using requests hooks, but I don't want to pass them in each request.</p>
  
  <p>I want something global/session like this:</p>
  
  <pre><code>import requests
  
  def forwarder_pre_request_hook(req, *args, **args):
     # do the trick I want, and replace the hostname and port of the url
     # I would still need to figure howto do it.
     return req
  
  # globally 
  requests.hooks = dict(pre_request=forwarder_pre_request_hook)
  
  # per session
  requests.Session(hooks=dict(pre_request=forwarder_pre_request_hook))
  </code></pre>
  
  <p>is it possible ?</p>