- o = urlparse(sub_data['callback'])
- if o.scheme == 'https':
- conn = get_https_conn_default(o.netloc)
- else:
- conn = get_http_conn(o.netloc)
- try:
- rst, status = post_data(conn, o.path, callback_data)
- if rst is True:
- logger.info(
- 'Notify to SMO successed with status: {}'.format(status))
- return
- logger.error('Notify Response code is: {}'.format(status))
- except ssl.SSLCertVerificationError as e:
- logger.debug(
- 'Notify try to post data with trusted ca failed: {}'.format(e))
- if 'self signed' in str(e):
- conn = get_https_conn_selfsigned(o.netloc)
- try:
- return post_data(conn, o.path, callback_data)
- except Exception as e:
- logger.info(
- 'Notify post data with self-signed ca \
- failed: {}'.format(e))
- # TODO: write the status to extension db table.
- return False
- return False
- except Exception as e:
- logger.critical('Notify except: {}'.format(e))
- return False
+ # o = urlparse(sub_data['callback'])
+ # if o.scheme == 'https':
+ # conn = get_https_conn_default(o.netloc)
+ # else:
+ # conn = get_http_conn(o.netloc)
+ # try:
+ # rst, status = post_data(conn, o.path, callback_data)
+ # if rst is True:
+ # logger.info(
+ # 'Notify to SMO successed with status: {}'.format(status))
+ # return
+ # logger.error('Notify Response code is: {}'.format(status))
+ # except ssl.SSLCertVerificationError as e:
+ # logger.debug(
+ # 'Notify try to post data with trusted ca failed: {}'.format(e))
+ # if 'self signed' in str(e):
+ # conn = get_https_conn_selfsigned(o.netloc)
+ # try:
+ # return post_data(conn, o.path, callback_data)
+ # except Exception as e:
+ # logger.info(
+ # 'Notify post data with self-signed ca \
+ # failed: {}'.format(e))
+ # return False
+ # return False
+ # except Exception as e:
+ # logger.critical('Notify except: {}'.format(e))
+ # return False