Search code examples
pythonurlurlparse

Python's `urlparse`: Adding GET keywords to a URL


I'm doing this:

urlparse.urljoin('http://example.com/mypage', '?name=joe')

And I get this:

'http://example.com/?name=joe'

While I want to get this:

'http://example.com/mypage?name=joe'

What am I doing wrong?


Solution

  • I solved it by bundling Python 2.6's urlparse module with my project. I also had to bundle namedtuple which was defined in collections, since urlparse uses it.