Suddenly, python started working very slowly on my pc (I use Kubuntu 24.04)
I’ve tried to figure out what’s happening and found that problem in the network request.
Here is the simple code and profile:
import requests
requests.get("https://google.com")
httpx works the same. Python 3.11/3.10/3.12 works the same
Other internet apps, like browsers, messengers, etc., work well.
How can I fix it?
2
Answers
I figured it out. In connection settings, I added DNS: 8.8.8.8, 8.8.4.4 and disabled ip6
Thanks for all
Seems to indicate a networking issue, in particular with establishing the connection. A few areas to check:
DNS Configuration – Check your DNS settings and think about switching to a faster DNS provider like Cloudflare or Google DNS.
Slowdowns during the SSL handshake could mean a potential SSL misconfiguration or issues with certificate verification. Update your SSL certificates
Python requests can potentially hang if IPv6 is misconfigured. You can resolve this by disabling IPv6.
Update your Python libraries.