469,578 Members | 1,843 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

urllib2 problem with ports.

Ant
Hi all,

I have just moved to a new machine, and so have installed the latest
version of Python (2.4.3 - previously I believe I was running 2.4.2).
Unfortunately this seems to have broken urllib2...

An app I wrote for testing our web application makes heavy use of
urllib2 against the localhost, and I am getting the following problem
(minimal code sample):

#/usr/bin/python
import urllib2

urllib2.urlopen("http://localhost:8080/")

This gives the output (Stack trace snipped - can post if required):

urllib2.HTTPError: HTTP Error 502: Proxy Error ( The Uniform Resource
Locator (U
RL) does not use a recognized protocol. Either the protocol is not
supported or
the request was not typed correctly. Confirm that a valid protocol is
in use (fo
r example, HTTP for a Web request). )

This I believe is a problem with the addition of a non-default port.
Replace the url with "http://google.com" for example, and all is well.

Any ideas for workarounds? Or do I roll back to 2.4.2?

Jun 15 '06 #1
2 4222
Ant wrote:
This gives the output (Stack trace snipped - can post if required):

urllib2.HTTPError: HTTP Error 502: Proxy Error ( The Uniform Resource
Locator (URL) does not use a recognized protocol. Either the protocol This I believe is a problem with the addition of a non-default port.
Replace the url with "http://google.com" for example, and all is well.

Any ideas for workarounds? Or do I roll back to 2.4.2?


that's not a Python error, so that won't help.

check your proxy configuration. most likely, your new machine is set up
to route all requests via a remote proxy.

(on windows, you'll find the proxy configuration under "Internet
Options" - "Connections" - "LAN Settings". before you do anything else,
make sure "Bypass proxy server for local addresses" is checked)

</F>
Jun 15 '06 #2
Ant

Fredrik Lundh wrote:
check your proxy configuration. most likely, your new machine is set up
to route all requests via a remote proxy.
Here's me looking like a fool :-) The parts of the machine (eg Firefox,
GAIM etc) that I'd set up use a direct connection - it looks like the
guy who'd had the machine before me used a proxy with IE...
(on windows, you'll find the proxy configuration under "Internet
Options" - "Connections" - "LAN Settings". before you do anything else,
make sure "Bypass proxy server for local addresses" is checked)


Interestingly the "Bypass proxy server for local addresses" was
checked. Anyway, I've changed it to a direct connection, and all seems
well. Thanks.

Jun 16 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by O. Koch | last post: by
4 posts views Thread by bmiras | last post: by
1 post views Thread by Matthew Wilson | last post: by
2 posts views Thread by John F Dutcher | last post: by
5 posts views Thread by Pascal | last post: by
1 post views Thread by rx | last post: by
reply views Thread by Ali.Sabil | last post: by
3 posts views Thread by m.banaouas | last post: by
1 post views Thread by Alessandro Fachin | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.