Module geolink_formatter¶
GeoLinkFormatter¶
-
class
geolink_formatter.
GeoLinkFormatter
(host_url=None, version='1.2.0', dtd_validation=False)[source]¶ Bases:
object
Creates a new GeoLinkFormatter instance.
Parameters: - host_url (str) – URL of the OEREBlex host to resolve relative URLs. The complete URL until but without the /api part has to be set, starting with http:// or https://.
- version (str) – The version of the geoLink schema to be used. Defaults to 1.2.0.
- dtd_validation (bool) – Enable/disable validation of document type definition (DTD). Optional, defaults to False.
-
html
(source)[source]¶ Returns the HTML representation of the geoLink XML form the specified source.
Parameters: source (str or bytes) – The geoLink source. Can be a XML string or an URL to load the XML via HTTP/HTTPS request.
Returns: An HTML formatted string containing the documents as HTML list.
Return type: str
Raises: TypeError
– Raised on invalid source type.lxml.etree.XMLSyntaxError
– Raised on failed validation.requests.HTTPError
– Raised on failed HTTP request.