aboutsummaryrefslogtreecommitdiffstats
path: root/catalog/packages/biz/notificationsutil.py
diff options
context:
space:
mode:
authorhongyuzhao <zhao.hongyu@zte.com.cn>2020-02-20 15:18:36 +0800
committerhongyuzhao <zhao.hongyu@zte.com.cn>2020-02-20 15:25:23 +0800
commit1487db0615f16783fd01998a0f71fb2d8f97a434 (patch)
treefb2edf5a03dbec467e446f242ec0b68246a5b004 /catalog/packages/biz/notificationsutil.py
parent0eaa773364c415f946860fef6f69f1fcda414178 (diff)
Fix for ETSI Catalog Manager does not support HTTPS for Test Notification Endpoint and Notification
Change-Id: I5c0133ea163b98c74fb668f2b77aaa95ec1cc3ec Issue-ID: MODELING-315 Signed-off-by: hongyuzhao <zhao.hongyu@zte.com.cn>
Diffstat (limited to 'catalog/packages/biz/notificationsutil.py')
-rw-r--r--catalog/packages/biz/notificationsutil.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/catalog/packages/biz/notificationsutil.py b/catalog/packages/biz/notificationsutil.py
index a18c4b3..3a1c60c 100644
--- a/catalog/packages/biz/notificationsutil.py
+++ b/catalog/packages/biz/notificationsutil.py
@@ -87,8 +87,13 @@ class NotificationsUtil(object):
params = auth_info.get("paramsBasic", {})
username = params.get("userName")
password = params.get("password")
- resp = requests.post(callbackuri, data=notification, headers={'Connection': 'close'},
- auth=HTTPBasicAuth(username, password))
+ resp = requests.post(callbackuri,
+ data=notification,
+ headers={'Connection': 'close',
+ 'content-type': 'application/json',
+ 'accept': 'application/json'},
+ auth=HTTPBasicAuth(username, password),
+ verify=False)
elif const.OAUTH2_CLIENT_CREDENTIALS in auth_info.get("authType", ''):
# todo
pass
@@ -96,9 +101,15 @@ class NotificationsUtil(object):
# todo
pass
else:
- resp = requests.post(callbackuri, data=notification, headers={'Connection': 'close'})
- if resp.status_code != status.HTTP_204_NO_CONTENT:
- logger.error("Sending notification to %s failed: %s" % (callbackuri, resp.text))
+ resp = requests.post(callbackuri,
+ data=notification,
+ headers={'Connection': 'close',
+ 'content-type': 'application/json',
+ 'accept': 'application/json'},
+ verify=False)
+
+ if resp.status_code == status.HTTP_204_NO_CONTENT:
+ logger.error("Sending notification to %s failed: %s" % (callbackuri, resp))
else:
logger.info("Sending notification to %s successfully.", callbackuri)
except: