wcs: return empty/error response for requests made to nonexistent sites (#39972)

This commit is contained in:
Frédéric Péters 2020-02-19 10:23:01 +01:00
parent fa17bffadf
commit 9c841ea861
1 changed files with 5 additions and 0 deletions

View File

@ -26,7 +26,12 @@ def get_wcs_services():
return {}
return settings.KNOWN_SERVICES.get('wcs')
def get_wcs_json(wcs_site, path):
if wcs_site is None:
# no site specified (probably an import referencing a not yet deployed
# site)
return {'err': 1, 'err_desc': 'no-wcs-site'}
response = requests.get(path, remote_service=wcs_site, without_user=True,
headers={'accept': 'application/json'})
if response.status_code != 200: