[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    urlparse isn't working?
From:       Dale Strickland-Clark <dale () riverhall ! NOTHANKS ! co ! uk>
Date:       2002-07-31 20:35:05
[Download RAW message or body]

This doesn't seem right to me:

>>> import urlparse
>>> urlparse.urlparse('www.wibble.com/wibble/wibble.jpg', 'http:')
('http:', '', 'www.wibble.com/wibble/wibble.jpg', '', '', '')

According to the help file:
===
Example: 

urlparse('http://www.cwi.nl:80/%7Eguido/Python.html')
yields the tuple 

('http', 'www.cwi.nl:80', '/%7Eguido/Python.html', '', '', '')
===

it should split the host from the path.

I've tried different values for the second parameter (called
'default_scheme') with the same result.

However, if you add "http://" to the url, it starts to behave:

>>> urlparse.urlparse('http://www.wibble.com/wibble/wibble.jpg')
('http', 'www.wibble.com', '/wibble/wibble.jpg', '', '', '')

So what is the point of the 'default_scheme' if it needs to be on the
url to work properly? 

Or have I got confused?
--
Dale Strickland-Clark
Riverhall Systems Ltd
-- 
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic