8000 Merge pull request #247 from davidmoss/develop · waynr/github3.py@71a4eef · GitHub
[go: up one dir, main page]

Skip to content

Commit 71a4eef

Browse files
committed
Merge pull request sigmavirus24#247 from davidmoss/develop
Adding support for calling URL with invalid SSL cert
2 parents 2ebe446 + 630fbe5 commit 71a4eef

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

AUTHORS.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,5 @@ Contributors
6262
- Benjamin Gilbert (@bgilbert)
6363

6464
- Daniel Johnson (@danielj7)
65+
66+
- David Moss (@damoss007)

github3/github.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1459,10 +1459,14 @@ class GitHubEnterprise(GitHub):
14591459
14601460
There is no need to provide the end of the url (e.g., /api/v3/), that will
14611461
be taken care of by us.
1462+
1463+
If you have a self signed SSL for your local github enterprise you can
1464+
override the validation by passing `verify=False`.
14621465
"""
1463-
def __init__(self, url, login='', password='', token=''):
1466+
def __init__(self, url, login='', password='', token='', verify=True):
14641467
super(GitHubEnterprise, self).__init__(login, password, token)
14651468
self._session.base_url = url.rstrip('/') + '/api/v3'
1469+
self._session.verify = verify
14661470

14671471
def _repr(self):
14681472
return '<GitHub Enterprise [0.url]>'.format(self)

tests/test_github.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import github3
2+
23
from tests.utils import (BaseCase, load, mock)
34

45

@@ -852,6 +853,19 @@ def test_pubsubhubbub(self):
852853
self.mock_assertions()
853854

854855

856+
class TestUnsecureGitHubEnterprise(BaseCase):
857+
def setUp(self):
858+
super(TestUnsecureGitHubEnterprise, self).setUp()
859+
self.g = github3.GitHubEnterprise('https://github.example.com:8080/', verify=False)
860+
861+
def test_skip_ssl_validation(self):
862+
self.response('pull_enterprise')
863+
self.g.pull_request('sigmavirus24', 'github3.py', 19)
864+
865+
assert False == self.g._session.verify
866+
assert self.request.called
867+
868+
855869
class TestGitHubStatus(BaseCase):
856870
def setUp(self):
857871
super(TestGitHubStatus, self).setUp()

0 commit comments

Comments
 (0)
0