From 4423691e7d7ccc0de84810293476d4251b565bfc Mon Sep 17 00:00:00 2001 From: Amund Isaksen Date: Tue, 20 Feb 2024 12:14:41 +0100 Subject: [PATCH] Add new grpc object calling --- api/dependencies.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/api/dependencies.py b/api/dependencies.py index 820f1de3..97ac108c 100644 --- a/api/dependencies.py +++ b/api/dependencies.py @@ -6,11 +6,14 @@ import datastore_pb2 as dstore from fastapi import HTTPException from google.protobuf.timestamp_pb2 import Timestamp -from grpc_getter import getTSAGRequest +from grpc_getter import gRPCRequest from pydantic import AwareDatetime from pydantic import TypeAdapter +grpc_request = gRPCRequest() + + def get_datetime_range(datetime_string: str | None) -> Tuple[Timestamp, Timestamp] | None: if not datetime_string: return None @@ -63,7 +66,7 @@ async def get_current_parameter_names(ttl_hash=None): async def async_helper(ttl_hash): del ttl_hash # make linter think we used this value unique_parameter_names = dstore.GetTSAGRequest(attrs=["parameter_name"]) - unique_parameter_names = await getTSAGRequest(unique_parameter_names) + unique_parameter_names = await grpc_request.getTSAGRequest(unique_parameter_names) return set([i.combo.standard_name for i in unique_parameter_names.groups])