[lxml-dev] Setting URL from lxml.html.fromstring, etc
Ian Bicking
ianb at colorstudy.com
Mon Feb 18 00:38:22 CET 2008
There doesn't seem to be any way to set a document's URL when parsing
the document. E.g.:
>>> from lxml import html
>>> tree = html.parse('http://www.python.org')
>>> tree.docinfo.URL
'http://www.python.org'
But the parse function doesn't really take any arguments, and the URL
attribute is write-only. Ideally you could do fromstring('...doc...',
URL='location'). (Also I'm not sure why the URL shouldn't be writable.)
Ian
More information about the lxml-dev
mailing list