[MapProxy] WMS-C as a source
Jean-Claude Repetto
jrepetto at free.fr
Thu Mar 8 13:55:23 EST 2012
On 03/08/12 19:11, Oliver Tonnhofer wrote:
>
> On 07.03.2012, at 22:19, Jeff Konnen wrote:
>> for the record I've worked around this issue by adding the following:
>>
>> def open_image(self, url, data=None):
>> resp = self.open(url, data=data)
>> if 'content-type' in resp.headers:
>> if not resp.headers['content-type'].lower().startswith('image'):
>> if resp.read().find("no-data")>-1:
>> raise HTTPClientError('no-data exeception',-999)
>> else:
>> raise HTTPClientError('response is not an image: (%s)' % (resp.read()))
>> return ImageSource(resp)
>
>
> This "no-data" is unfortunately not a standard error code :)
> But maybe it is a good idea to set the internal response code to 500 in case it did not get an image back?
>
Hello,
I think the more appropriate error code for the "no-data" case is :
204 No Content
Jean-Claude
More information about the MapProxy
mailing list