简体   繁体   中英

Python requests extremely slow in a specific machine

I found that the requests module works extremely slow in my laptop, something like this will take more than 3 minutes to complete.

    import requests
    r = requests.get('https://api.github.com/events')
    r.text

I can access that page using browser with no delay, I can run this in google colaboratory within a second, I can run it on another computer using the same network within a second, so there must be something wrong with my laptop.

But how can I know what exactly is going wrong?

thé time To reach the server may be different because of different dns network resolution. implied by different network setting on this computer. you can watch the path To reach github using traceroute or tracepath api.github.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM