Which should I be using: urlparse or urlsplit?

Matt Joiner picture Matt Joiner · Mar 29, 2011 · Viewed 10.4k times · Source

Which URL parsing function pair should I be using and why?

Answer

Sven Marnach picture Sven Marnach · Mar 29, 2011

Directly from the docs you linked yourself:

urllib.parse.urlsplit(urlstring, scheme='', allow_fragments=True)
This is similar to urlparse(), but does not split the params from the URL. This should generally be used instead of urlparse() if the more recent URL syntax allowing parameters to be applied to each segment of the path portion of the URL (see RFC 2396) is wanted.