-1

I just did a fresh Raspberry OS install and now I don't get a requests.get() response in Python for most pages, it just becomes stuck and does not respond (interestingly, the address from the example on https://www.w3schools.com/python/module_requests.asp works, but https://google.com doesn't). Surprisingly, with the argument timeout=n it works after about n seconds. However, fixing the bug by adding a time out or some extra code is not convenient, because I use some modules relying on requests.get and fixing them manually can't be the best solution. Does anybody know why adding a time out is necessary now? When I used the old Raspbian OS, the very same scripts on the same device just worked.

import requests

x = requests.get('https://w3schools.com/python/demopage.htm')

works,

import requests

x = requests.get('https://google.com')

doesn't - it takes forever and never returns.

import requests

x = requests.get('https://google.com', timeout=1)

returns after 1 second.

DeepKling
  • 144
  • 4
  • We cannot help you debug your code if you don't share your code. Please provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). Please also see [how to ask a good question](https://stackoverflow.com/help/how-to-ask). – ddejohn Feb 04 '22 at 18:53

1 Answers1

0

I think this had to do with some IPv6 problems - the timeout forced the usage of IPv4? Disabling IPv6 in the router menu did the job.

DeepKling
  • 144
  • 4