Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _discover(self):
raw_locations = self._get_locations()
for raw_location in raw_locations:
try:
location = Location.from_api_response(self, raw_location)
except KeyError as ex:
_LOG.error(('Failed to process location `%s`: '
'missing %s element'),
raw_location.get('LocationID', 'unknown'),
ex.args[0])
self._locations[location.locationid] = location