Getting a 401 from requests.get, but not when logging in via the browser.

dcwhatthe at gmail.com dcwhatthe at gmail.com
Tue Apr 21 13:11:06 EDT 2020


On Tuesday, April 21, 2020 at 12:40:25 PM UTC-4, Dieter Maurer wrote:
> dc wrote at 2020-4-20 14:48 -0700:
> > ...
> >I tried telneting the landing page, i.e. without the specific node that requires the login.  So e.g.
> >
> >Telnet thissite.oh.gov 80
> >
> >, but it returns a 400 Bad Request.  Before that, the Telnet screen is completely blank ; I have to press a key before it returns the Bad Request.
> >
> >
> >Roger on knowing what the site is asking for.  But I don't know how to determine that.
> 
> I use `wget -S` to learn about server responses.
> I has the advantage (over `telnet`) to know the HTTP protocl.

Sure enough, wget DOES return a lot of information.  In fact, although an initial response of 401 is returned, it waits for the response and finally returns a 200.

So, I guess the question finally comes down to:  How do we make the requests.get() wait for a response?  The timeout value isn't the same thing that I thought it was.  So how do we tell .get() to wait 20 or 30 seconds for an OK response?



More information about the Python-list mailing list