Repository: PyGithub/PyGithub

Issue:
add ignore SSL option for github enterprise accessibility
Please provide a 'verify=False' kinda flag for accessing enterprise servers with self signed certificates.


Discussion:

Resolving patch:
diff --git a/github/MainClass.py b/github/MainClass.py
--- a/github/MainClass.py
+++ b/github/MainClass.py
@@ -81,7 +81,7 @@ class Github(object):
     This is the main class you instantiate to access the Github API v3. Optional parameters allow different authentication methods.
     """
 
-    def __init__(self, login_or_token=None, password=None, base_url=DEFAULT_BASE_URL, timeout=DEFAULT_TIMEOUT, client_id=None, client_secret=None, user_agent='PyGithub/Python', per_page=DEFAULT_PER_PAGE, api_preview=False):
+    def __init__(self, login_or_token=None, password=None, base_url=DEFAULT_BASE_URL, timeout=DEFAULT_TIMEOUT, client_id=None, client_secret=None, user_agent='PyGithub/Python', per_page=DEFAULT_PER_PAGE, api_preview=False, verify=True):
         """
         :param login_or_token: string
         :param password: string
@@ -91,6 +91,7 @@ def __init__(self, login_or_token=None, password=None, base_url=DEFAULT_BASE_URL
         :param client_secret: string
         :param user_agent: string
         :param per_page: int
+        :param verify: boolean or string
         """
 
         assert login_or_token is None or isinstance(login_or_token, (str, unicode)), login_or_token
@@ -101,7 +102,7 @@ def __init__(self, login_or_token=None, password=None, base_url=DEFAULT_BASE_URL
         assert client_secret is None or isinstance(client_secret, (str, unicode)), client_secret
         assert user_agent is None or isinstance(user_agent, (str, unicode)), user_agent
         assert isinstance(api_preview, (bool))
-        self.__requester = Requester(login_or_token, password, base_url, timeout, client_id, client_secret, user_agent, per_page, api_preview)
+        self.__requester = Requester(login_or_token, password, base_url, timeout, client_id, client_secret, user_agent, per_page, api_preview, verify)
 
     def __get_FIX_REPO_GET_GIT_REF(self):
         """
diff --git a/github/Requester.py b/github/Requester.py
--- a/github/Requester.py
+++ b/github/Requester.py
@@ -90,6 +90,7 @@ def __init__(self, host, port=None, strict=False, timeout=None, **kwargs):
         self.host = host
         self.protocol = "https"
         self.timeout = timeout
+        self.verify = kwargs.get("verify", True)
         self.session = requests.Session()
 
     def request(self, verb, url, input, headers):
@@ -101,7 +102,7 @@ def request(self, verb, url, input, headers):
     def getresponse(self):
         verb = getattr(self.session, self.verb.lower())
         url = "%s://%s:%s%s" % (self.protocol, self.host, self.port, self.url)
-        r = verb(url, headers=self.headers, data=self.input, timeout=self.timeout)
+        r = verb(url, headers=self.headers, data=self.input, timeout=self.timeout, verify=self.verify)
         return RequestsResponse(r)
 
     def close(self):
@@ -115,6 +116,7 @@ def __init__(self, host, port=None, strict=False, timeout=None, **kwargs):
         self.host = host
         self.protocol = "http"
         self.timeout = timeout
+        self.verify = kwargs.get("verify", True)
         self.session = requests.Session()
 
     def request(self, verb, url, input, headers):
@@ -126,7 +128,7 @@ def request(self, verb, url, input, headers):
     def getresponse(self):
         verb = getattr(self.session, self.verb.lower())
         url = "%s://%s:%s%s" % (self.protocol, self.host, self.port, self.url)
-        r = verb(url, headers=self.headers, data=self.input, timeout=self.timeout)
+        r = verb(url, headers=self.headers, data=self.input, timeout=self.timeout, verify=self.verify)
         return RequestsResponse(r)
 
     def close(self):
@@ -208,7 +210,7 @@ def _initializeDebugFeature(self):
 
     #############################################################
 
-    def __init__(self, login_or_token, password, base_url, timeout, client_id, client_secret, user_agent, per_page, api_preview):
+    def __init__(self, login_or_token, password, base_url, timeout, client_id, client_secret, user_agent, per_page, api_preview, verify):
         self._initializeDebugFeature()
 
         if password is not None:
@@ -250,6 +252,7 @@ def __init__(self, login_or_token, password, base_url, timeout, client_id, clien
             'See http://developer.github.com/v3/#user-agent-required'
         self.__userAgent = user_agent
         self.__apiPreview = api_preview
+        self.__verify = verify
 
     def requestJsonAndCheck(self, verb, url, parameters=None, headers=None, input=None, cnx=None):
         return self.__check(*self.requestJson(verb, url, parameters, headers, input, cnx))
@@ -429,6 +432,7 @@ def __createConnection(self):
         if not atLeastPython3:  # pragma no branch (Branch useful only with Python 3)
             kwds["strict"] = True  # Useless in Python3, would generate a deprecation warning
         kwds["timeout"] = self.__timeout
+        kwds["verify"] = self.__verify
 
         if self.__persist and self.__connection is not None:
             return self.__connection


Test patch: