[Twisted-Python] URL encoding

Is there any method in twisted that does proper url encoding? For example 'http://www.example.com/part1 part2.html' -> 'http://www.example.com/part1%20part2.html'

On Mon, Mar 24, 2008 at 7:48 AM, Vasil Vangelovski <vvangelovski@gmail.com> wrote:
What about urllib.quote or urllib.urlencode? http://docs.python.org/lib/module-urllib.html ~ Nathan

urllib.quote is useless as is
urllib.quote('http://www.example.com/part1 part2.html') 'http%3A//www.example.com/part1%20part2.html
and from what I understand urllib.urlencode is for encoding query parameters. On Mon, Mar 24, 2008 at 3:40 PM, Nathan <nathan.stocks@gmail.com> wrote:

On Mon, 24 Mar 2008 16:20:05 +0100, Vasil Vangelovski <vvangelovski@gmail.com> wrote:
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. Jean-Paul

On Mon, Mar 24, 2008 at 9:20 AM, Vasil Vangelovski <vvangelovski@gmail.com> wrote:
So don't give it the 'http://www.example.com/' part. ~ Nathan

On Mon, Mar 24, 2008 at 7:48 AM, Vasil Vangelovski <vvangelovski@gmail.com> wrote:
What about urllib.quote or urllib.urlencode? http://docs.python.org/lib/module-urllib.html ~ Nathan

urllib.quote is useless as is
urllib.quote('http://www.example.com/part1 part2.html') 'http%3A//www.example.com/part1%20part2.html
and from what I understand urllib.urlencode is for encoding query parameters. On Mon, Mar 24, 2008 at 3:40 PM, Nathan <nathan.stocks@gmail.com> wrote:

On Mon, 24 Mar 2008 16:20:05 +0100, Vasil Vangelovski <vvangelovski@gmail.com> wrote:
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. Jean-Paul

On Mon, Mar 24, 2008 at 9:20 AM, Vasil Vangelovski <vvangelovski@gmail.com> wrote:
So don't give it the 'http://www.example.com/' part. ~ Nathan
participants (5)
-
Drew Smathers
-
J. Cliff Dyer
-
Jean-Paul Calderone
-
Nathan
-
Vasil Vangelovski