fixes to ham talm

This commit is contained in:
xss 2022-06-30 16:59:50 +10:00
parent a1e68edb91
commit 6a62101fad

View File

@ -261,9 +261,12 @@ def get_telem_full(event, context):
"queryStringParameters" in event "queryStringParameters" in event
and "datetime" in event["queryStringParameters"] and "datetime" in event["queryStringParameters"]
): ):
try:
requested_time = datetime.fromisoformat( requested_time = datetime.fromisoformat(
event["queryStringParameters"]["datetime"].replace("Z", "+00:00") event["queryStringParameters"]["datetime"].replace("Z", "+00:00")
) )
except: # might be in unix time
requested_time = datetime.utcfromtimestamp(float(event["queryStringParameters"]["datetime"]))
else: else:
requested_time = datetime.now(timezone.utc) requested_time = datetime.now(timezone.utc)
@ -383,10 +386,11 @@ def get_telem_full(event, context):
return { return {
"body": body, "body": body,
"isBase64Encoded": True, "isBase64Encoded": True,
"statusCode": 400, "statusCode": 200,
"headers": { "headers": {
"Content-Encoding": "gzip", "Content-Encoding": "gzip",
"content-type": content_type "Content-Disposition": "attachment",
"Content-Type": content_type
} }
} }