Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _message(self, json):
"""
Sends message to robot with data from parameter 'json'
:param json: dict containing data to send
:return: server response
"""
try:
response = requests.post(self._url,
json=json,
verify=self._vendor.cert_path,
auth=Auth(self.serial, self.secret),
headers=self._headers)
response.raise_for_status()
except (requests.exceptions.ConnectionError,
requests.exceptions.HTTPError):
raise NeatoRobotException("Unable to communicate with robot")
return response