windows - Python web request slow through Proxy -


some background: work corporation uses proxy. ping/nslookup blocked, , think may contributing following problem. operating system being used windows, , version of python i'm testing 3.4.3.

i'm trying create application communicates webservice, , application run inside our network. however, requests take on 10 seconds complete, while in web browser loads in under second. note these requests succeed, take long usable.

i profiled application using cprofile module, , found application spending 11 seconds on gethostbyaddr, , 4 seconds on gethostbyname.

i'm not familiar enough networks, timeout? why request go through despite timeout? how disable these operations? , if can't, there library not use these operations?

i tried both requests , urllib modules. pip exceedingly slow , may because of same cause.

thanks in advance or information on subject.

edit

i tried monkey patching socket.gethostbyaddr , socket.gethostbyname, , speed delay gone. doesn't feel proper solution though.

import requests import socket  def do_nothing(*args):     return none socket.gethostbyaddr = do_nothing socket.gethostbyname = do_nothing  r = requests.get('https://google.com') print(r.status_code) # prints 200 


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -