Added a closure for the hook in order to pass arbitrary parameters to the hook passed to requests. Currently, this is only used to implement the (new) max_refresh parameter which specifies an upper bound on the refresh time returned by the server.
Not backwards compatible, as now the create_hook function must be called to get the hook instead of importing it directly.