[docs] [issue8818] urlsplit and urlparse add extra slash when using scheme

AdamN report at bugs.python.org
Tue May 25 19:41:54 CEST 2010


AdamN <adam at varud.com> added the comment:

Ok, you're right:

>>> urlsplit('cnn.com')
SplitResult(scheme='', netloc='', path='cnn.com', query='', fragment='')
>>> urlsplit('//cnn.com')
SplitResult(scheme='', netloc='cnn.com', path='', query='', fragment='')
>>> 

Although I see that nowhere in the documentation.  It seems to me that in the scenario most people are dealing with, where they are getting 'cnn.com' or 'http://cnn.com' but don't know which ahead of time, this will be useless.  I don't see who would ever have '//cnn.com' without constructing that string specifically for urlsplit.

I would propose that '/whatever' becomes the path because it starts with slash, otherwise, it becomes the netloc and everything after the first slash becomes the path.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8818>
_______________________________________


More information about the docs mailing list