@@ -59,7 +59,10 @@ def __init__(self,
59
59
def login (self , user = '' , password = '' ):
60
60
"""Convenience method for calling user.authenticate and storing the resulting auth token
61
61
for further commands.
62
- If use_authenticate is set, it uses the older (Zabbix 1.8) authentication command"""
62
+ If use_authenticate is set, it uses the older (Zabbix 1.8) authentication command
63
+ :param password: Password used to login into Zabbix
64
+ :param user: Username used to login into Zabbix
65
+ """
63
66
64
67
# If we have an invalid auth token, we are not allowed to send a login
65
68
# request. Clear it before trying.
@@ -69,13 +72,17 @@ def login(self, user='', password=''):
69
72
else :
70
73
self .auth = self .user .login (user = user , password = password )
71
74
72
- def confimport (self , format = '' , source = '' , rules = '' ):
75
+ def confimport (self , confformat = '' , source = '' , rules = '' ):
73
76
"""Alias for configuration.import because it clashes with
74
- Python's import reserved keyword"""
77
+ Python's import reserved keyword
78
+ :param rules:
79
+ :param source:
80
+ :param confformat:
81
+ """
75
82
76
83
return self .do_request (
77
84
method = "configuration.import" ,
78
- params = {"format" : format , "source" : source , "rules" : rules }
85
+ params = {"format" : confformat , "source" : source , "rules" : rules }
79
86
)['result' ]
80
87
81
88
def api_version (self ):
@@ -93,7 +100,6 @@ def do_request(self, method, params=None):
93
100
if self .auth and method != 'apiinfo.version' :
94
101
request_json ['auth' ] = self .auth
95
102
96
-
97
103
logger .debug ("Sending: %s" , json .dumps (request_json ,
98
104
indent = 4 ,
99
105
separators = (',' , ': ' )))
@@ -124,7 +130,7 @@ def do_request(self, method, params=None):
124
130
self .id += 1
125
131
126
132
if 'error' in response_json : # some exception
127
- if 'data' not in response_json ['error' ]: # some errors don't contain 'data': workaround for ZBX-9340
133
+ if 'data' not in response_json ['error' ]: # some errors don't contain 'data': workaround for ZBX-9340
128
134
response_json ['error' ]['data' ] = "No data"
129
135
msg = "Error {code}: {message}, {data}" .format (
130
136
code = response_json ['error' ]['code' ],
0 commit comments