GithubHelp home page GithubHelp logo

Comments (20)

kracekumar avatar kracekumar commented on July 24, 2024

Yes, there isn't data, so replace line41 of requests_oauthlib/core.py with decoded_body = extract_params(r.body)
and replace line 50 with if hasattr(r, 'files') and contenttype == CONTENT_TYPE_MULTI_PART: and then code should raise

raise TwythonAuthError("Seems something couldn't be verified with your OAuth junk. Error: %s, Message: %s" % (response.status_code, response.content))

from requests-oauthlib.

Lukasa avatar Lukasa commented on July 24, 2024

Pull Request? =D

from requests-oauthlib.

kracekumar avatar kracekumar commented on July 24, 2024

@Lukasa sure 👍

from requests-oauthlib.

ib-lundgren avatar ib-lundgren commented on July 24, 2024

I'm so not keeping up with the times. Just noticed randomly that this was split into it's own repo and broken with the requests refactoring while I was debugging some old code. I quick-fixed it in passing locally and was just about to add an issue here to remember to one day clean it up and push it. Lo and behold you guys are already on it. I love open source =)

hasattr(r, 'files') will however cause trouble since r in this case is a PreparedRequest without that attribute. If the prepare_auth was moved to after prepare_body (https://github.com/kennethreitz/requests/blob/master/requests/models.py#L201) then it would probably be fine just omitting the files check as the content type should be set.

I've not tested any multipart data yet tho so might be mistaken, I'll dig deeper later this week if none else beats me to it.

from requests-oauthlib.

Lukasa avatar Lukasa commented on July 24, 2024

Please get back to us with the result of your investigation. In the absence of good tests for this code, we need as much user feedback as possible. =)

from requests-oauthlib.

ib-lundgren avatar ib-lundgren commented on July 24, 2024

Well the reason the files check was there in the first place was because of the internal order of things in pre-1.0 requests where the content type was not always set, especially not before the auth call. The only thing this extension needs to do is to sort out some unicode issues (or else stuff will break deep down in other libraries, or so it used to) and help figure out content-type if not set.

I'll try and crave an hour or two out of tomorrow and add some tests for this. Anyone know if there is a particular reason for prepare_body coming after prepare_auth? If not that's a good place to start making life easier for content-type guessing.

Oh btw, and there is no full_url anymore, just url.

from requests-oauthlib.

Lukasa avatar Lukasa commented on July 24, 2024

This library has had only one change to bring it up to date with v1 of Requests, and that was #3. I'm spread way too thin to get around to this any time soon, so any help you can provide would be awesome. =)

from requests-oauthlib.

ib-lundgren avatar ib-lundgren commented on July 24, 2024

decoded_body and r.body being None under certain circumstances might also cause grief. I'll need to update myself a bit on how things are meant to be done with the new requests structure then patch it. That might take a day or two so don't hesitate to beat me to it...

from requests-oauthlib.

ib-lundgren avatar ib-lundgren commented on July 24, 2024

Know the feeling =) I'll try and sort it out either here or on oauthlibs side this week.

from requests-oauthlib.

ib-lundgren avatar ib-lundgren commented on July 24, 2024

Threw together some quick fixes in #4.

from requests-oauthlib.

mikofski avatar mikofski commented on July 24, 2024

I am so stupid! I have been beating my head against the wall because of this for at least an hour and a half!

Please push a new tag and update pypi. Thanks.

Until then, does anyone think the current master is ready for prime time?

from requests-oauthlib.

michaelhelmick avatar michaelhelmick commented on July 24, 2024

@mikofski requests-oauthlib master is update-to-date with this change. requests, I believe, is awaiting the changes to make this all working. See #4 (comment)

from requests-oauthlib.

ib-lundgren avatar ib-lundgren commented on July 24, 2024

Master works fine and you can see an example flask-twitter use here https://gist.github.com/4487236

Requests has pushed the change and it is included in at least 1.0.4. requests-oauthlib however needs to push master.

Note that you still need to provide all input in unicode. After oauthlib pushes 0.4 this will no longer be necessary if your input is utf-8 encoded. However, before I push I need to do some further testing. I'll ping this issue when done.

from requests-oauthlib.

mikofski avatar mikofski commented on July 24, 2024

Thanks @ib-lundgren & @michaelhelmick! I did ...

pip install -U git+git://github.com/requests/requests-oauthlib.git

which updated me to master and now all is well!

from requests-oauthlib.

estebistec avatar estebistec commented on July 24, 2024

was this included in a release? I'm seeing this issue now with req 1.2.0 and req-oauthlib 0.3.0

from requests-oauthlib.

ib-lundgren avatar ib-lundgren commented on July 24, 2024

It was included and is for certain in 0.3. Make sure that is really the version you are using as I'm unable to replicate this. If it persists please provide a stack trace / code sample.

from requests-oauthlib.

estebistec avatar estebistec commented on July 24, 2024

16:42:42 # pip freeze -l | grep requests
requests==1.2.0
requests-oauthlib==0.3.0

from requests-oauthlib.

estebistec avatar estebistec commented on July 24, 2024

sorry, I'll come back with a good sample replicating it soon but time doesn't allow at the moment. :/ I'll try to distill it down tomorrow.

from requests-oauthlib.

ib-lundgren avatar ib-lundgren commented on July 24, 2024

No worries. One thing that might help you is if you try and setup a new virtualenv and see if you still have the same error.

virtualenv test
source test/bin/activate
pip install requests-oauthlib
# try your code

from requests-oauthlib.

estebistec avatar estebistec commented on July 24, 2024

Okay, I see what's going on. It's intentional that data was going away and the preferred attribute is truly body. This pull request doesn't put the data attribute back, it updates requests-oauthlib to not rely on it. We were introspecting response.requests trying to build better error logs. Looks like we'll need to update our code accordingly. Thanks.

from requests-oauthlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.