mirror of
https://github.com/projecthorus/sondehub-infra.git
synced 2024-12-21 06:03:11 +00:00
add chase only
This commit is contained in:
parent
2f34d42df2
commit
4d8fda7441
@ -225,7 +225,8 @@ def datanew(event, context):
|
|||||||
else:
|
else:
|
||||||
lt = datetime.now(timezone.utc)
|
lt = datetime.now(timezone.utc)
|
||||||
gte = datetime.now(timezone.utc) - timedelta(0, duration)
|
gte = datetime.now(timezone.utc) - timedelta(0, duration)
|
||||||
|
output = {"positions": {"position": []}}
|
||||||
|
if "chase_only" not in event["queryStringParameters"] or event["queryStringParameters"]["chase_only"] != "true":
|
||||||
path = "telm-*/_search"
|
path = "telm-*/_search"
|
||||||
payload = {
|
payload = {
|
||||||
"aggs": {
|
"aggs": {
|
||||||
@ -282,7 +283,7 @@ def datanew(event, context):
|
|||||||
)
|
)
|
||||||
results = es_request(payload, path, "POST")
|
results = es_request(payload, path, "POST")
|
||||||
|
|
||||||
output = {"positions": {"position": []}}
|
|
||||||
|
|
||||||
for sonde in results["aggregations"]["2"]["buckets"]:
|
for sonde in results["aggregations"]["2"]["buckets"]:
|
||||||
for frame in sonde["3"]["buckets"]:
|
for frame in sonde["3"]["buckets"]:
|
||||||
@ -569,12 +570,13 @@ if __name__ == "__main__":
|
|||||||
# position_id: 0
|
# position_id: 0
|
||||||
# vehicles: RS_*;*chase
|
# vehicles: RS_*;*chase
|
||||||
print(
|
print(
|
||||||
get_listeners(
|
datanew(
|
||||||
{
|
{
|
||||||
"queryStringParameters": {
|
"queryStringParameters": {
|
||||||
"type" : "positions",
|
"type" : "positions",
|
||||||
"mode": "1hour",
|
"mode": "6hours",
|
||||||
"position_id": "0"
|
"position_id": "0",
|
||||||
|
"chase_only": "true"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
|
@ -223,6 +223,13 @@ paths:
|
|||||||
- "6hours"
|
- "6hours"
|
||||||
- "3hours"
|
- "3hours"
|
||||||
- "1hour"
|
- "1hour"
|
||||||
|
- in: query
|
||||||
|
name: chase_only
|
||||||
|
type: string
|
||||||
|
description: Return only chase cars
|
||||||
|
enum:
|
||||||
|
- "true"
|
||||||
|
- "false"
|
||||||
- in: query
|
- in: query
|
||||||
name: vehicles
|
name: vehicles
|
||||||
type: string
|
type: string
|
||||||
|
Loading…
Reference in New Issue
Block a user