1

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!

fsiddi
  • 101
  • 6
  • Have you tried with debugging on? See [Dive into Python 3](http://getpython3.com/diveintopython3/http-web-services.html#whats-on-the-wire) – RolfBly Jan 08 '14 at 21:40

1 Answers1

0

maybe using requests would be better

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

koder
  • 1
  • 1
  • Requests seems to have the same problem. – fsiddi Jan 06 '14 at 16:15
  • hmmm will have to test this more. is this happening on osx or linux? will test on my macbook and see what i can find out in the meantime try you might look into this http://stackoverflow.com/a/8400299/1813556 – koder Jan 07 '14 at 04:18