[Twisted-Python] URL encoding

Jean-Paul Calderone exarkun at divmod.com
Mon Mar 24 11:33:11 EDT 2008

On Mon, 24 Mar 2008 16:20:05 +0100, Vasil Vangelovski <vvangelovski at gmail.com> wrote:
>urllib.quote is useless as is
>>>> urllib.quote('http://www.example.com/part1 part2.html')
>and from what I understand urllib.urlencode is for encoding query parameters.

It's not useless, it just doesn't make any sense to use it that way.  Use
urllib.quote on each segment value _before_ you build the larger URL out
of it.

    'http://www.example.com/' + urllib.quote('part1 part2.html')

Since this isn't really Twisted related, please follow up on the subject
on comp.lang.python.


More information about the Twisted-Python mailing list