Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if len(endpoint) <= 0:
return None
else:
return endpoint[0].get('Endpoint')
elif 400 <= status < 500:
# print "serviceCode=" + service_code + " get location error!
# code=" + result.get('Code') +", message =" +
# result.get('Message')
return None
elif status >= 500:
# return None instead of throw an exception
# in case of location service failure
# SDK still has to work for robustness
return None
else:
raise exs.ClientException(
result.get('Code'), result.get('Message'))
except IOError:
# return None instead of throw an exception
# in case of location service unreachable,
# SDK still has to work for robustness
return None
except AttributeError:
raise exs.ClientException(
error_code.SDK_INVALID_REQUEST,
error_msg.get_msg('SDK_INVALID_REQUEST'))
return None
elif status >= 500:
# return None instead of throw an exception
# in case of location service failure
# SDK still has to work for robustness
return None
else:
raise exs.ClientException(
result.get('Code'), result.get('Message'))
except IOError:
# return None instead of throw an exception
# in case of location service unreachable,
# SDK still has to work for robustness
return None
except AttributeError:
raise exs.ClientException(
error_code.SDK_INVALID_REQUEST,
error_msg.get_msg('SDK_INVALID_REQUEST'))