Skip to content
This repository

Allow lists in the dict values of the hooks argument #785

flub opened this Issue · 5 comments

3 participants

Floris Bruynooghe Ian Cordasco Kenneth Reitz
Floris Bruynooghe
flub commented

Currently the Request class has a .register_hook() method but it parses the dictionary it expects from it's hooks argument weirdly: the argument can only specify one hook function per hook. If you pass in a list of hook functions per hook the code in Request.init() will wrap the list in a list which then fails when the hooks are consumed (since a list is not callable). This is especially annoying since you can not use multiple hooks from a session. The only way to get multiple hooks now is to create the request object without sending it, then call .register_hook() multiple times and then finally call .send().

This would all be much easier if Request.init() parsed the hooks parameter in a way that it accepts lists as it's values.

Ian Cordasco

If anyone OKs this feature request, I'd be happy to dig into it.

Kenneth Reitz

Just need to make sure that the current workflow also continues to work with this change.

Ian Cordasco

Once @kennethreitz has time to review #833, I'll start working on this. I have a feeling opening a branch for this would cause a merge conflict if I were to have two Pull Requests that are ignorant of each other for the same file. Could be wrong though. Also, I'm in no rush since I'm fairly busy and I know @kennethreitz is more busy than I am with conferences and whatnot. Just wanted to keep @flub updated.

Ian Cordasco

I'm going to start work on this Friday at the earliest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.