From: Phonethics Mobile Media on
handler = urllib2.urlopen(req) is taking way too much time to retrieve
the URL. The same code using sockets in PHP doesn't delay this long.
I had 'Authorization':'Basic ' + base64.b64encode("username:password")
in my header though.
[ I didnt use HTTPPasswordMgr & HTTPPasswordMgrWithDefaultRealm
because I was unable to send headers with the example shown here : ]

I have data = handler.readline() in a loop - this is an endless
network script (twitter streaming) so cant really wait for the entire
url contents to finish loading.

I had to socket.setdefaulttimeout to 30 to make it work.
Is it because python is getting chunks in high number of KBs ?

Python 2.6.2