From 1ad368c6753e39e7121980b2fdeaba2c4dc49f08 Mon Sep 17 00:00:00 2001 From: Benjamin Webb <40066515+webb-ben@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:56:11 -0400 Subject: [PATCH] Update ckan.py --- pygeoapi_plugins/provider/ckan.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pygeoapi_plugins/provider/ckan.py b/pygeoapi_plugins/provider/ckan.py index 7d4b08b..07d3900 100644 --- a/pygeoapi_plugins/provider/ckan.py +++ b/pygeoapi_plugins/provider/ckan.py @@ -42,6 +42,10 @@ LOGGER = logging.getLogger(__name__) +HEADERS = { + 'User-Agent': 'pygeoapi_plugins.ckan', + 'Accept': 'application/json' +} class CKANProvider(BaseProvider): """CKAN API Provider""" @@ -244,13 +248,11 @@ def _get_response(self, url, params={}): :returns: STA response """ params.update({'resource_id': self.resource_id}) - headers = {'User-Agent': 'pygeoapi_plugins.ckan'} - r = self.http.get(url, params=params, headers=headers) + r = self.http.get(url, params=params, headers=HEADERS) if not r.ok: LOGGER.error('Bad http response code') raise ProviderConnectionError('Bad http response code') - print(r.url) try: response = r.json() except JSONDecodeError as err: