load_url

igwn_ligolw.utils.load_url(url, verbose=False, **kwargs)

Parse the contents of file at the given URL and return the contents as a LIGO Light Weight document tree. Any source from which Python’s urllib library can read data is acceptable. stdin is parsed if url is None. Helpful verbosity messages are printed to stderr if verbose is True. When url is not a local file, urllib.request.urlopen() is used to access it, and if the keyword arguments timeout and/or context is set then those arguments are passed to urlopen(). All other keyword arguments are passed to load_fileobj(), see that function for more information.

Example:

>>> from os import getcwd
>>> xmldoc = load_url("file://localhost/%s/test/demo.xml" % getcwd(), verbose = True)