skip to Main Content

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")

profile

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


  1. Chosen as BEST ANSWER

    I figured it out. In connection settings, I added DNS: 8.8.8.8, 8.8.4.4 and disabled ip6

    Thanks for all


  2. Seems to indicate a networking issue, in particular with establishing the connection. A few areas to check:

    1. DNS Configuration – Check your DNS settings and think about switching to a faster DNS provider like Cloudflare or Google DNS.

    2. Slowdowns during the SSL handshake could mean a potential SSL misconfiguration or issues with certificate verification. Update your SSL certificates

       sudo apt update
       sudo apt install --reinstall ca-certificates
      
    3. Python requests can potentially hang if IPv6 is misconfigured. You can resolve this by disabling IPv6.

    4. Update your Python libraries.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search