Auto-update: Thu Aug 1 23:53:07 PDT 2024

This commit is contained in:
sanj 2024-08-01 23:53:07 -07:00
parent 299d27b1e7
commit f7d5b06518
2 changed files with 2 additions and 2 deletions

View file

@ -1176,7 +1176,6 @@ class Location(BaseModel):
} }
populate_by_name = True populate_by_name = True
class Geocoder: class Geocoder:
def __init__(self, named_locs: Union[str, Path] = None, cache_file: Union[str, Path] = 'timezone_cache.json'): def __init__(self, named_locs: Union[str, Path] = None, cache_file: Union[str, Path] = 'timezone_cache.json'):
self.tf = TimezoneFinder() self.tf = TimezoneFinder()

View file

@ -528,12 +528,13 @@ async def post_locate_endpoint(locations: Union[Location, List[Location]]):
return {"message": "Locations and weather updated", "results": responses} return {"message": "Locations and weather updated", "results": responses}
@gis.get("/locate", response_model=Location) @gis.get("/locate", response_model=Location)
async def get_last_location_endpoint() -> JSONResponse: async def get_last_location_endpoint() -> JSONResponse:
this_location = await get_last_location() this_location = await get_last_location()
if this_location: if this_location:
location_dict = this_location.model_dump() location_dict = this_location.model_dump(mode='json')
return JSONResponse(content=location_dict) return JSONResponse(content=location_dict)
else: else:
raise HTTPException(status_code=404, detail="No location found before the specified datetime") raise HTTPException(status_code=404, detail="No location found before the specified datetime")