httplib.InvalidURL: nonnumeric port: For characters in the proxypassword in URL

Fredrik Lundh fredrik at pythonware.com
Mon Nov 13 07:12:05 EST 2006


"Phoe6" wrote:

>> if you want to prevent the URI parser from treating something as part of
>> the URI, you need to quote it:
>>
>>     pwd = urllib.quote(pwd, "")
>
> Tried this and did not work out. It ended up confusing urllib and
> urllib2 objects.

oh, please.  urllib.quote is a *function*; there's no way that calling that function
from code written for urllib2 will affect anything.

but you can access urllib.quote from the urllib2 namespace too.  it's actually the
very same function:

>>> urllib.quote
<function quote at 0x00F430F0>
>>> urllib2.quote
<function quote at 0x00F430F0>

(urllib2 imports lots of stuff from urllib)

> I dont want to import urllib, with the urllib2 itself wanted to work
> around this piece of code.

not wanting to solve a problem is a pretty lousy problem-solving strategy, really.

</F> 






More information about the Python-list mailing list