[issue1462525] URI parsing library
report at bugs.python.org
Tue Nov 20 19:57:05 CET 2007
vincent kraeutler added the comment:
Quite like urlparse, uriparse does not fail on input which does not
represent valid URI's. At least not early or reliably enough.
Specifically, I noticed that urisplit does not fail on input strings
with a missing scheme, such as "foo.com/bar".
I see no (straightforward) solution to this problem, short of using a
proper parser library such as Haskell's Parsec (I unfortunately know of
no Python equivalent), but I thought I might want to report this issue
The following might work as a quick-fix: Replace
with something like:
mm = re.match(regex, uri)
sp = mm.span()
if (-1 in sp) or (sp - sp != len(uri)):
raise ValueError, "uri regex did not match complete input"
p = mm.groups()
Tracker <report at bugs.python.org>
More information about the Python-bugs-list