Вопрос

I have the following /etc/hosts

127.0.0.1    my-server-name

Then I run this code:

import urllib2

f = urllib2.urlopen('http://my-server-name')
print f.read()

If I’m connected to the interned via wifi (or if the Ethernet interface is off), the request takes 0.2s. If I’m using the wired connection it takes up to 10s.

I’ve been reading that it might be a cache-related issue, but I was not able to find a solution.

Any idea on how to solve this would be highly appreciated, thank you!

Нет правильного решения

Другие советы

maybe using requests would be better

http://docs.python-requests.org/en/latest/

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top