Giter Club home page Giter Club logo

Comments (8)

fjarlq avatar fjarlq commented on July 28, 2024 1

I was hitting the same problem that @jcomeauictx originally reported: my Authorization header was being mysteriously transformed from Bearer into Basic.

I was baffled until I searched for "Basic" in the issues for the requests project, which turned up this recent bug report: psf/requests#3929

That was indeed my problem. I have this line in my $HOME/.netrc to enable automatic login for anonymous FTP:

default login anonymous password anonymous@

requests interprets that to mean it should always override the Authorization header with my .netrc default, even when the caller has explicitly provided an Authorization header.

According to a comment in that bug report, a requests core developer is amenable to changing this behavior in requests 3.0 so that when the caller sets Authorization it won't get overridden.

Until then, perhaps python-digitalocean should consider the advice of requests core developer @Lukasa:

"So it is quite possible that the library wrapping requests should be setting trust_env to False if it is handling headers itself."

Thoughts, @koalalorenzo? Thanks!

from python-digitalocean.

jcomeauictx avatar jcomeauictx commented on July 28, 2024

I have requests version 2.4.3

from python-digitalocean.

jcomeauictx avatar jcomeauictx commented on July 28, 2024

requests 2.7.0 no help either.

from python-digitalocean.

koalalorenzo avatar koalalorenzo commented on July 28, 2024

If it is a request problem, maybe we should open an issue there, instead of python-digitalocean
Can you confirm that this is a bug related to request? I had no time to test it. I will do it probably tomorrow.

from python-digitalocean.

jcomeauictx avatar jcomeauictx commented on July 28, 2024

I cannot confirm at this time. but since this bug makes the library unusable, wouldn't you want to know anyway, so you could code around the problem?

from python-digitalocean.

koalalorenzo avatar koalalorenzo commented on July 28, 2024

since this bug makes the library unusable, wouldn't you want to know anyway, so you could code around the problem?

OFC. That's why I will check tomorrow ;-) I suggest you to do the same!
I admit that request in past caused some errors because they changed the way they were using options for specific methods. I will check tomorrow after some sleep! ;-)

from python-digitalocean.

jcomeauictx avatar jcomeauictx commented on July 28, 2024

OK thanks.

from python-digitalocean.

koalalorenzo avatar koalalorenzo commented on July 28, 2024

It works fine for me, using also requests v 2.4.3
I am going to trigger some automatic tests to be sure that everything is fine.

I was reading your code without understanding what is happening. Are you sure that your code is not messing up with requests? Have you tried on another OS/Machine? So fare it does not seem a problem. If you find the bug, then feel free to re-open the issue 👍

from python-digitalocean.

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.