From 9e103f9c746e7dca49b2d6cd1982089f72c5ef25 Mon Sep 17 00:00:00 2001 From: "Luiz G. Costa" Date: Mon, 28 Jan 2019 11:48:35 +0000 Subject: [PATCH] json module is not needed, it already exists in the requests --- centreonapi/webservice/__init__.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) 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()