Cannot recalculate body in pre-request hook #6

Closed
maxcountryman opened this Issue Mar 17, 2012 · 4 comments

Comments

Projects
None yet
2 participants
Contributor

maxcountryman commented Mar 17, 2012

I won't go into great detail, the issue is well documented on Requests itself here: kennethreitz/requests#445

This is a show stopper for POSTs that don't use header_auth unfortunately.

Contributor

joeshaw commented Mar 19, 2012

Is the longer term solution still to drop the hook altogether?

Contributor

maxcountryman commented Mar 19, 2012

I'm just about to send you an email about this. That is one option but I'm not sure what the best way forward is, so I'll send you this email. ;)

Contributor

maxcountryman commented Mar 26, 2012

Due to the fact that it seems as though the previous proposal to address this behavior of hooks may not be merged into Requests for the foreseeable future at least, I've gone ahead and whipped up my own patch that attempts to be as unobtrusive as possible while allowing applications utilizing hooks to hack around problems like this.

Here is the pull request: kennethreitz/requests#502

There hasn't been feedback from Kenneth yet so I'm not sure what the likelihood of this being merged is but I am hopeful that something will be merged in the not-so-distant future which will give us some avenue to address this bug.

Contributor

maxcountryman commented Mar 30, 2012

In the meantime if you find yourself in need of making POSTs that CANNOT use header auth and REQUIRE params/body you can use requests directly in the interim:

requests.post(url,
              data=dict(client_id=service.consumer_key,
                        client_secret=service.consumer_secret,
                        foo=bar))

That should get you by for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment