|
@@ -19,15 +19,15 @@ def call_api(endpoint, method="GET", params=None, data=None) -> dict:
|
|
|
for i in range(3):
|
|
|
try:
|
|
|
if method.upper() == "GET":
|
|
|
- response = requests.get(url, params=params, cookies=cookies)
|
|
|
+ response = requests.get(url, params=params, cookies=cookies, verify=False)
|
|
|
elif method.upper() == "POST":
|
|
|
- response = requests.post(url, json=data, params=params, cookies=cookies)
|
|
|
+ response = requests.post(url, json=data, params=params, cookies=cookies, verify=False)
|
|
|
else:
|
|
|
raise ValueError("Unsupported HTTP method")
|
|
|
logger.info(f"Calling API: {endpoint}, Method: {method}, Params: {params}, Data: {data}, ResCode:{response.status_code}, ResData: {response.text}")
|
|
|
if response.status_code == 502:
|
|
|
cookies = LoginApi().login_bmc(config.USERNAME, config.PASSWORD)
|
|
|
- raise NoValidError()
|
|
|
+ continue
|
|
|
response.raise_for_status()
|
|
|
return response.json()
|
|
|
except requests.RequestException as e:
|