On 7/23/07, John Nagle wrote:
> Here's another hard case.  This one might be a bug in urlparse:
>
> import urlparse
>
> s = 'ftp://administrator:[EMAIL PROTECTED]/originals/6 june
> 07/ebay/login/ebayisapi.html'
>
> urlparse.urlparse(s)
>
> yields:
>
> (u'ftp', u'administrator:[EMAIL PROTECTED]', u'/originals/6 june
> 07/ebay/login/ebayisapi.html', '', '', '')
>
> That second field is supposed to be the "hostport" (per the RFC usage
> of the term; Python uses the term "netloc"), and the username/password
> should have been parsed and moved to the "username" and "password" fields
> of the object. So it looks like urlparse doesn't really understand FTP URLs.

Those values aren't "moved" to the fields; they're extracted on the
fly from the netloc.  Use the .hostname property of the result tuple
to get just the hostname.

-Miles
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to