@@ -31,13 +31,13 @@ def __init__(self, params=None):
31
31
super ().__init__ (params )
32
32
33
33
def manage_activation (self ):
34
- if config .get_first_var_set (self .master .request_id , [ "API_REPORTER" , "NOTIF_API_REPORTER" ] , "false" ) == "true" :
34
+ if config .get (self .master .request_id , "API_REPORTER" , "false" ) == "true" :
35
35
if (
36
36
config .exists (self .master .request_id , "API_REPORTER_URL" ) or
37
- config .exists (self .master .request_id , "NOTIF_API_REPORTER_URL " )
37
+ config .exists (self .master .request_id , "NOTIF_API_URL " )
38
38
):
39
39
self .is_active = True
40
- self .api_url = config .get_first_var_set (self .master .request_id , ["API_REPORTER_URL" ,"NOTIF_API_REPORTER_URL " ])
40
+ self .api_url = config .get_first_var_set (self .master .request_id , ["API_REPORTER_URL" ,"NOTIF_API_URL " ])
41
41
else :
42
42
logging .error ("You need to define API_REPORTER_URL to use ApiReporter" )
43
43
@@ -161,16 +161,16 @@ def send_to_api(self):
161
161
# Use username & password
162
162
if (
163
163
config .exists (self .master .request_id , "API_REPORTER_BASIC_AUTH_USERNAME" ) or
164
- config .exists (self .master .request_id , "NOTIF_API_REPORTER_BASIC_AUTH_USERNAME " )
164
+ config .exists (self .master .request_id , "NOTIF_API_BASIC_AUTH_USERNAME " )
165
165
):
166
166
session .auth = (
167
- config .get_first_var_set (self .master .request_id , ["API_REPORTER_BASIC_AUTH_USERNAME" ,"NOTIF_API_REPORTER_BASIC_AUTH_USERNAME " ]),
168
- config .get_first_var_set (self .master .request_id , ["API_REPORTER_BASIC_AUTH_PASSWORD" ,"NOTIF_API_REPORTER_BASIC_AUTH_PASSWORD " ]),
167
+ config .get_first_var_set (self .master .request_id , ["API_REPORTER_BASIC_AUTH_USERNAME" ,"NOTIF_API_BASIC_AUTH_USERNAME " ]),
168
+ config .get_first_var_set (self .master .request_id , ["API_REPORTER_BASIC_AUTH_PASSWORD" ,"NOTIF_API_BASIC_AUTH_PASSWORD " ]),
169
169
)
170
170
# Use token
171
171
if (
172
172
config .exists (self .master .request_id , "API_REPORTER_BEARER_TOKEN" ) or
173
- config .exists (self .master .request_id , "NOTIF_API_REPORTER_BEARER_TOKEN " )
173
+ config .exists (self .master .request_id , "NOTIF_API_BEARER_TOKEN " )
174
174
):
175
175
headers ["Authorization" ] = (
176
176
f"Bearer { config .get_first_var_set (self .master .request_id , ["API_REPORTER_BEARER_TOKEN" ,"NOTIF_API_REPORTER_BEARER_TOKEN" ])} "
@@ -183,7 +183,7 @@ def send_to_api(self):
183
183
logging .info (
184
184
f"[Api Reporter] Successfully posted data to { self .api_url } "
185
185
)
186
- if config .get_first_var_set (self .master .request_id ,[ "API_REPORTER_DEBUG" ,"NOTIF_API_REPORTER_DEBUG " ]):
186
+ if config .get_first_var_set (self .master .request_id ,[ "API_REPORTER_DEBUG" ,"NOTIF_API_DEBUG " ]):
187
187
logging .info (json .dumps (obj = self .payloadFormatted , indent = True ))
188
188
else :
189
189
logging .warning (
0 commit comments