2121class FarmCalendarServiceClient (MicroserviceClient ):
2222
2323 def __init__ (self , app : FastAPI ):
24- super ().__init__ (base_url = config .FARM_CALENDAR_URL , service_name = "Farm Calendar" , app = app )
24+ super ().__init__ (base_url = config .GATEKEEPER_FARM_CALENDAR_API , service_name = "Farm Calendar" , app = app )
2525
2626 @backoff .on_exception (
2727 backoff .expo ,
@@ -32,14 +32,14 @@ def __init__(self, app: FastAPI):
3232 max_tries = 3
3333 )
3434 async def fetch_or_create_activity_type (self , activity_type : str , description : str ) -> str :
35- act_jsonld = await self .get (f'/api/v1/ FarmCalendarActivityTypes/?name={ activity_type } ' )
35+ act_jsonld = await self .get (f'/FarmCalendarActivityTypes/?name={ activity_type } ' )
3636
3737 if not self ._get_activity_type_id (act_jsonld ):
3838 json_payload = {
3939 "name" : activity_type ,
4040 "description" : description ,
4141 }
42- act_jsonld = await self .post ('/api/v1/ FarmCalendarActivityTypes/' , json = json_payload )
42+ act_jsonld = await self .post ('/FarmCalendarActivityTypes/' , json = json_payload )
4343
4444 return self ._get_activity_type_id (act_jsonld )
4545
@@ -78,7 +78,7 @@ def _get_activity_type_id(self, jsonld: dict) -> Optional[str]:
7878 max_tries = 3
7979 )
8080 async def fetch_locations (self ):
81- response = await self .get ('/api/v1/ FarmParcels/' )
81+ response = await self .get ('/FarmParcels/' )
8282
8383 locations = []
8484 for parcel in response .get ("@graph" , []):
@@ -116,7 +116,7 @@ async def fetch_and_cache_locations(self):
116116 max_tries = 3
117117 )
118118 async def fetch_uavs (self ):
119- response = await self .get (f'/api/v1/ AgriculturalMachines/' )
119+ response = await self .get (f'/AgriculturalMachines/' )
120120 uavmodels = [ uav .get ("model" ) for uav in response .get ("@graph" , []) if uav .get ("model" , None )]
121121 return uavmodels
122122
@@ -155,7 +155,7 @@ async def send_thi(self, lat, lon):
155155 )
156156 json_payload = observation .model_dump (by_alias = True , exclude_none = True )
157157 logger .debug (json_payload )
158- await self .post ('/api/v1/ Observations/' , json = json_payload )
158+ await self .post ('/Observations/' , json = json_payload )
159159
160160 # Async function to post Flight Forecast data with JWT authentication
161161 @backoff .on_exception (
@@ -189,7 +189,7 @@ async def send_flight_forecast(self, lat, lon, uavmodels):
189189 )
190190 json_payload = observation .model_dump (by_alias = True , exclude_none = True )
191191 logger .debug (json_payload )
192- await self .post ('/api/v1/ Observations/' , json = json_payload )
192+ await self .post ('/Observations/' , json = json_payload )
193193
194194 # Async function to post spray conditions Forecast data with JWT authentication
195195 @backoff .on_exception (
@@ -224,4 +224,4 @@ async def send_spray_forecast(self, lat, lon):
224224
225225 json_payload = observation .model_dump (by_alias = True , exclude_none = True )
226226 logger .debug (json_payload )
227- await self .post ('/api/v1/ Observations/' , json = json_payload )
227+ await self .post ('/Observations/' , json = json_payload )
0 commit comments