473,320 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 4419
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: O. Koch | last post by:
Until now, i know that ftplib doesn't support proxies and that i have to use urllib2. But i don't know how to use the urllib2 correct. I found some examples, but i don't understand them. Is...
4
by: bmiras | last post by:
I've got a problem using urllib2 to get a web page. I'm going through a proxy using user/password authentification and i'm trying to get a page asking for a HTTP authentification. And I'm using...
1
by: Matthew Wilson | last post by:
I am writing a script to check on my router's external IP address. My ISP refreshes my IP very often and I use dyndns for the hostname for my computer. My Netgear mr814 router has a webserver that...
2
by: John F Dutcher | last post by:
Can anyone comment on why the code shown in the Python error is in some way incorrect...or is there a problem with Python on my hoster's site ?? The highlites don't seem to show here...but line...
5
by: Pascal | last post by:
Hello, I want to acces my OWA (Outlook Web Acces - http Exchange interface) server with urllib2 but, when I try, I've always a 401 http error. Can someone help me (and us)? Thanks. ...
1
by: rx | last post by:
I'm trying to hide my IP with the following code: import urllib2 proxy= opener=urllib2.build_opener(proxy) f=opener.open('http://www.whatismyipaddress.com') print f.read() But that didn't...
0
by: Ali.Sabil | last post by:
hello all, I just maybe hit a bug in both urllib and urllib2, actually urllib doesn't support proxy authentication, and if you setup the http_proxy env var to...
3
by: m.banaouas | last post by:
Hi all, I started to use urllib2 library and HTTPBasicAuthHandler class in order to authenticate with a http server (Zope in this case). I don't know why but it doesn't work, while authenticating...
1
by: Alessandro Fachin | last post by:
I write this simply code that should give me the access to private page with htaccess using a proxy, i don't known because it's wrong... import urllib,urllib2 #input url...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.