I\'ve experienced too slow execution of Python requests on some machines and with specific user while other tools (for instance curl) are quite fast. Strange thing is that i
Had similar problem. After investigation determined that python's internal call to socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): was causing the delay.
In my configuration, I was on a Mac, OS/X 10.11. host was dev.local, and I had the relevant entry in /etc/hosts, pointing to a virtual box machine setup on host-only network.
192.168.56.101 dev.local
After banging my head for an hour or two, realized that hostnames ending with .local was the actual issue (despite the /etc/hosts entry).
This eventually lead me to https://superuser.com/questions/539849/long-lookup-times-for-local-in-hosts-file. And voilà, avoiding made up host names with .local was all I needed.
I do realize this isn't the problem here -- 10.50.30.216 obviously doesn't end with .local! But since this question was one of the most relevant ones I ran into looking for an answer to my problem, I thought I'd post an answer here.