From 0a65e1cb4a84aa8efcc9a95de201d348f5e9e014 Mon Sep 17 00:00:00 2001 From: aistoica Date: Tue, 10 Jul 2018 17:16:26 +0300 Subject: [PATCH] SSL Certificate verification Allow the user to disable SSL certificate verification --- PythonConfluenceAPI/api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PythonConfluenceAPI/api.py b/PythonConfluenceAPI/api.py index 170fd7a..9e5b84d 100644 --- a/PythonConfluenceAPI/api.py +++ b/PythonConfluenceAPI/api.py @@ -59,7 +59,7 @@ class ConfluenceAPI(object): ATTACHMENT_METADATA_KEYS = {"id", "type", "version", "title"} UPDATE_CONTENT_REQUIRED_KEYS = {"id", "version"} - def __init__(self, username, password, uri_base, user_agent=DEFAULT_USER_AGENT): + def __init__(self, username, password, uri_base, user_agent=DEFAULT_USER_AGENT, verifyCert=true): """ Initialize the API object. :param username: Your Confluence username. @@ -73,6 +73,7 @@ def __init__(self, username, password, uri_base, user_agent=DEFAULT_USER_AGENT): self.uri_base = uri_base if uri_base.endswith('/') else uri_base + "/" self.user_agent = user_agent self.session = None + self.verifyCert = verifyCert def _start_http_session(self): """ @@ -81,6 +82,8 @@ def _start_http_session(self): """ api_logger.debug("Starting new HTTP session...") self.session = requests.Session() + if self.verifyCert == False + self.session.verify = False self.session.headers.update({"User-Agent": self.user_agent}) if self.username and self.password: api_logger.debug("Requests will use authorization.")