test-http.py 294 B

1234567891011
  1. import sys,urllib2
  2. request = urllib2.Request("http://" + sys.argv[1] + ":" + sys.argv[2] + "/index.html")
  3. opener = urllib2.build_opener()
  4. response = opener.open(request, timeout=10)
  5. while True:
  6. data = response.read(1024)
  7. if data:
  8. sys.stdout.write(data)
  9. else:
  10. break