Skip to content

Commit

Permalink
Update ckan.py
Browse files Browse the repository at this point in the history
  • Loading branch information
webb-ben committed Oct 15, 2024
1 parent da3128c commit 1ad368c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pygeoapi_plugins/provider/ckan.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@

LOGGER = logging.getLogger(__name__)

HEADERS = {
'User-Agent': 'pygeoapi_plugins.ckan',
'Accept': 'application/json'
}

class CKANProvider(BaseProvider):
"""CKAN API Provider"""
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 1ad368c

Please sign in to comment.