Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json module is not needed, it already exists in the requests #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions centreonapi/webservice/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-

import requests
import json
from requests.packages.urllib3.exceptions import InsecureRequestWarning


Expand Down Expand Up @@ -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
},
Expand Down Expand Up @@ -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()
Expand Down