66import httpx
77import requests
88from apps .event .serializers import CarsEventSerializer
9- from apps .feed .constants import (
9+ from apps .feed .constants import ( # WEBCAM,
1010 CURRENT_WEATHER ,
1111 CURRENT_WEATHER_STATIONS ,
1212 DISTRICT_BOUNDARIES ,
1818 REGIONAL_WEATHER ,
1919 REGIONAL_WEATHER_AREAS ,
2020 REST_STOP ,
21- # WEBCAM,
2221 WILDFIRE ,
2322)
2423from apps .feed .serializers import (
2928 EventFeedSerializer ,
3029 FerryAPISerializer ,
3130 RestStopSerializer ,
32- WebcamAPISerializer ,
33- WebcamFeedSerializer ,
3431)
3532from apps .shared .serializers import DistrictAPISerializer
3633from apps .weather .models import CurrentWeather
34+ from apps .webcam .models import CameraSource
3735from apps .wildfire .serializers import WildfireAreaSerializer , WildfirePointSerializer
3836from django .conf import settings
3937from django .contrib .gis .geos import Point
4038from django .core .cache import cache
4139from rest_framework .exceptions import ValidationError
4240from rest_framework .response import Response
43- from apps .weather .models import CurrentWeather
44- from apps .webcam .models import CameraSource , Region , RegionHighway
4541
4642# Maps the key for our client API's serializer fields to the matching pair of
4743# the source API's DataSetName and DisplayName fields
@@ -151,7 +147,7 @@ def _get_response_data_or_raise(response):
151147 logger .error (f"An error occurred with status: { response .status_code } " )
152148 response .raise_for_status ()
153149
154- def _process_get_request (self , endpoint , params , resource_type , timeout = 5 .0 ):
150+ def _process_get_request (self , endpoint , params , resource_type , timeout = 15 .0 ):
155151 logger .info (f"Requesting GET { endpoint } with params { params } " )
156152 response = httpx .get (
157153 endpoint ,
@@ -263,7 +259,6 @@ def get_list_feed(self, resource_type, resource_name, serializer_cls, params=Non
263259 new_serializer .is_valid (raise_exception = True )
264260 return new_serializer .validated_data
265261
266-
267262 def get_webcam_list (self ):
268263 try :
269264 cameras = list (CameraSource .objects .using ("mssql" ).all ())
@@ -272,7 +267,7 @@ def get_webcam_list(self):
272267 except Exception as e :
273268 logging .exception (f"Failed to query camera from Webcam database: { e } " )
274269 return []
275-
270+
276271 # Events
277272 def get_event (self , event ):
278273 return self .get_single_feed (event , OPEN511 , 'events/' , EventFeedSerializer )
@@ -326,7 +321,7 @@ def get_high_elevation_forecast_list(self):
326321 try :
327322 response = self .make_weather_request (area_code_endpoint )
328323 response .raise_for_status ()
329- json_response = response .json ()
324+ json_response = response .json ()
330325
331326 for entry in json_response :
332327 # only high elevation ares will return anything; skip others
@@ -398,11 +393,10 @@ def get_high_elevation_forecast_list(self):
398393 except requests .RequestException as e :
399394 logging .exception (f"Error making API call for Area Code { area_code } : { e } " )
400395
401-
402396 except requests .RequestException as e :
403397 logging .exception (f"Error fetching data from weather API: { e } " )
404-
405- return json_objects
398+
399+ return json_objects
406400
407401 # Current Weather
408402 def get_current_weather_list_feed (self , serializer_cls , token ):
0 commit comments