Skip to content

Commit f181d99

Browse files
authored
Ensure STA only uses configured netloc (#1883)
* Ensure STA only uses configured netloc Address edgecase where SensorthingsAPI returns a network location inaccessible by pygeoapi by ensuring any backfill requests we make use the configured network location instead of the response network location * fix flake8
1 parent 475c567 commit f181d99

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

pygeoapi/provider/sensorthings.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from json.decoder import JSONDecodeError
3333
import logging
3434
from requests import Session
35+
from urllib.parse import urlparse
3536

3637
from pygeoapi.config import get_config
3738
from pygeoapi.provider.base import (
@@ -209,6 +210,11 @@ def _load(self, offset=0, limit=10, resulttype='results',
209210
try:
210211
LOGGER.debug('Fetching next set of values')
211212
next_ = response['@iot.nextLink']
213+
214+
# Ensure we only use provided network location
215+
next_ = next_.replace(urlparse(next_).netloc,
216+
urlparse(self.data).netloc)
217+
212218
response = self._get_response(next_)
213219
v.extend(response['value'])
214220
except (ProviderConnectionError, KeyError):

0 commit comments

Comments
 (0)