sickle icon indicating copy to clipboard operation
sickle copied to clipboard

Add a warning if a server sends back non-XML

Open anthonybaxter opened this issue 3 years ago • 1 comments

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.

anthonybaxter avatar Jul 06 '21 01:07 anthonybaxter

Hm. further adventures suggest if (self.http_response.headers.get('Content-Type').split(";")[0] .lower() not in ('text/xml', 'application/xml')): is more robust.

anthonybaxter avatar Jul 06 '21 04:07 anthonybaxter