mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-18 18:07:37 +03:00
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:
parent
40a8a19ce4
commit
a48c33eda8
@ -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})')
|
||||
|
Loading…
x
Reference in New Issue
Block a user