drewcrawford / Phone-Pipe

97 stars 4 forks source link

Requests stall forever in urllib.urlopen #4

Open jrk opened 13 years ago

jrk commented 13 years ago

Running the latest , requests seem to spin forever waiting for data in on line 82 of phone. Testing manually, urllib.urlopen(your,params).read() never returns anything. curl -k -u my:keys -d"label=phonepipe&title=Hi&msg=Message&uri=" https://api.notifo.com/v1/send_notification works as expected at the same time, from the same host.

drewcrawford commented 13 years ago

Hi jrk,

I'm having some trouble reproducing this one. Are you behind any weird proxies? Can I get some more details about OS configuration?

Cheers Drew

jrk commented 13 years ago

This is on OS X 10.6.4 with system Python 2.6.1. It seems it's a bad interaction with Privoxy. Disabling Privoxy altogether fixes the problem, but bypassing Privoxy for [api.]notifo.com in the Network preferences, and/or in the Privoxy settings, doesn't seem to fix the problem.

drewcrawford commented 13 years ago

Reading over the Python documentation, I'm wondering if the bug is in upstream python. Supposedly, urllib automagically should sort out the proxies from System Preferences, but I wouldn't be surprised if it's not incredibly thorough.

Have you tried replacing it with urllib2.urlopen? If this solves your problem, I could move the library to urllib2. Otherwise I will probably need to set up an identical network configuration and try to pursue this in upstream python.

jrk commented 13 years ago

I suspected exactly this and did poke around. I didn't finish trying urllib2 I believe because it required a different mechanism than you use to set up the auth parameters (and I only had a few minutes to explore), but just manually running through the basic urllib fetch you do in a Python console produces the same hang.

drewcrawford commented 13 years ago

I really suspect a bug in upstream Python in terms of how it handles getting the proxy rules from OSX. To be honest, I probably won't get around to testing with urllib2 any time soon.