Most likely, DNS caching has accelerated requests. DNS queries can take a lot of time on corporate networks, I don’t know why, but I experience the same thing. The first time you sent a query with urllib2DNS requested, slow and cached. The second time you sent a request using requests, DNS does not need to be requested, just retrieved from the cache.
Clear the DNS cache and reorder, i.e. request from the requestsfirst, see if there is any difference.
source
share