cat /dev/brain

Requests 1.2.0

tl;dr dispatch_hook now sends the keyword arguments that were originally sent with the request. Hook authors should modify their hooks to accept them and resend them.

This morning Kenneth published (on PyPI and Crate) requests 1.2.0 which included a lot of very important changes. One, which will likely cause some pushback, is the change in how we dispatch our one and only hook. But first, as I always do, let me give you a bit of history.

The old dispatch_hook

Besides having other hooks that we maintained before 1.0.0, we also didn't have as many authentication handling schemes that were designed for requests. The original few were OAuth1 (now requests-oauthlib), Basic Authentication and Digest Authentication. Only one of these (Digest Authentication) relied on the response hook. Before 1.0.0, we added Kerberos authentication to requests thanks to Michael Komitee. This relied heavily on the response hook so it could handle 401s (like Digest Authentication does). Unfortuntely, neither of these ever honored the other keyword argument settings configured by the user. If prefetch or verify were passed specific values, they would not be reused for the subsequent requests made by the handlers.

The new dispatch_hook

During 1.0.0, Kenneth decided to remove everything except Basic and Digest Authentication from requests proper. At this point Cory and I decided we wanted to try to refactor requests-kerberos to work better and have tests. We both got side-tracked by other projects but Michael (the handler's original author) came back and did a complete refactor and realized that handlers were not honoring the user's request options, so he submitted a pull request to change how we dispatch hooks. It was (and still is) a very intelligent and well-thought out change, except for the fact that it will break a lot of people's code.

Some will start getting errors about receiving an unexpected argument 'stream' or 'verify', but this is good. They should be taking into consideration the settings passed in.

There are some other cool changes in 1.2.0 like better cookie handling and CookieJar integration but all of that is in the release notes, so go look at them.