sickle
sickle copied to clipboard
Add a warning if a server sends back non-XML
https://data.csiro.au/dap/ws/v2/collections is an example of a server that sends back JSON rather than XML to a sickle request by default.
Adding headers={'Accept': 'application/xml'} to the Sickle() constructor fixes that, but it was a bit of digging to work out why. This logging message would have saved me a bit of debugging time.
Hm. further adventures suggest if (self.http_response.headers.get('Content-Type').split(";")[0] .lower() not in ('text/xml', 'application/xml')): is more robust.