companion: Change record_endpoint() query_time to mandatory

This *does* need to be generated as close as possible to where the data
was received, and not rely on an actually not dynamic default.
This commit is contained in:
Athanasius committed 2021-08-25 13:45:42 +01:00
1 parent 40a8a19ce4
commit a48c33eda8
1 file changed
+5 -2
+5 -2
View File
@@ -150,7 +150,7 @@ class CAPIDataRaw:
def record_endpoint(
self, endpoint: str,
raw_data: str,
query_time: datetime.datetime = datetime.datetime.utcnow()
query_time: datetime.datetime
):
"""Record the latest raw data for the given endpoint."""
self.raw_data[endpoint] = CAPIDataRawEndpoint(raw_data, query_time)
@@ -740,7 +740,10 @@ class Session(object):
# May also fail here if token expired since response is empty
capi_json = r.json()
capi_data = CAPIData(capi_json, capi_endpoint)
self.capi_raw_data.record_endpoint(capi_endpoint, r.content.decode(encoding='utf-8'))
self.capi_raw_data.record_endpoint(
capi_endpoint, r.content.decode(encoding='utf-8'),
datetime.datetime.utcnow()
)
except requests.ConnectionError as e:
logger.warning(f'Unable to resolve name for CAPI: {e} (for request: {capi_endpoint})')