diff --git a/centreonapi/webservice/__init__.py b/centreonapi/webservice/__init__.py index 8b531dc..d20a574 100644 --- a/centreonapi/webservice/__init__.py +++ b/centreonapi/webservice/__init__.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- import requests -import json from requests.packages.urllib3.exceptions import InsecureRequestWarning @@ -58,7 +57,7 @@ def auth(self): """ request = requests.post( self.url + '/api/index.php?action=authenticate', - data={ + json={ 'username': self.authuser, 'password': self.authpass }, @@ -95,11 +94,8 @@ def call_clapi(self, action=None, obj=None, values=None): request = requests.post( self.url + '/api/index.php?action=action&object=centreon_clapi', - headers={ - 'Content-Type': 'application/json', - 'centreon-auth-token': self.auth_token - }, - data=json.dumps(data), + headers={'centreon-auth-token': self.auth_token}, + json=data, verify=self.check_ssl ) request.raise_for_status()