@@ -64,27 +64,27 @@ def _get_url_for_client_instance(self, client_class):
6464 url = self .base_url ))
6565
6666 def authenticate (self ):
67- self ._get_resource_areas ()
67+ self ._get_resource_areas (force = True )
6868
69- def _get_resource_areas (self ):
70- if self ._resource_areas is None :
69+ def _get_resource_areas (self , force = False ):
70+ if self ._resource_areas is None or force :
7171 location_client = LocationClient (self .base_url , self ._creds )
72- if RESOURCE_FILE_CACHE [location_client .normalized_url ]:
72+ if not force and RESOURCE_FILE_CACHE [location_client .normalized_url ]:
7373 try :
7474 logging .info ('File cache hit for resources on: %s' , location_client .normalized_url )
75- self ._locations = location_client ._base_deserialize .deserialize_data (RESOURCE_FILE_CACHE [location_client .normalized_url ],
76- '[ResourceAreaInfo]' )
77- return self ._locations
75+ self ._resource_areas = location_client ._base_deserialize .deserialize_data (RESOURCE_FILE_CACHE [location_client .normalized_url ],
76+ '[ResourceAreaInfo]' )
77+ return self ._resource_areas
7878 except Exception as ex :
7979 logging .exception (str (ex ))
80- else :
80+ elif not force :
8181 logging .info ('File cache miss for resources on: %s' , location_client .normalized_url )
8282 self ._resource_areas = location_client .get_resource_areas ()
8383 try :
8484 serialized = location_client ._base_serialize .serialize_data (self ._resource_areas , '[ResourceAreaInfo]' )
8585 RESOURCE_FILE_CACHE [location_client .normalized_url ] = serialized
86- except Exception as e :
87- logging .exception (str (e ))
86+ except Exception as ex :
87+ logging .exception (str (ex ))
8888 return self ._resource_areas
8989
9090 @staticmethod
0 commit comments