Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _response_for(self, path, model_class, ip_address):
if ip_address != 'me':
ip_address = str(compat_ip_address(ip_address))
uri = '/'.join([self._base_uri, path, ip_address])
response = requests.get(uri,
auth=(self._account_id, self._license_key),
headers={
'Accept': 'application/json',
'User-Agent': self._user_agent()
},
timeout=self._timeout)
if response.status_code != 200:
raise self._exception_for_error(response, uri)
body = self._handle_success(response, uri)
return model_class(body, locales=self._locales)