8000 Adding support for calling URL with invalid SSL cert by davidmoss · Pull Request #247 · sigmavirus24/github3.py · GitHub
[go: up one dir, main page]

Skip to content

Adding support for calling URL with invalid SSL cert #247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ Contributors
- Benjamin Gilbert (@bgilbert)

- Daniel Johnson (@danielj7)

- David Moss (@damoss007)
6 changes: 5 additions & 1 deletion github3/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -1459,10 +1459,14 @@ class GitHubEnterprise(GitHub):

There is no need to provide the end of the url (e.g., /api/v3/), that will
be taken care of by us.

If you have a self signed SSL for your local github enterprise you can
override the validation by passing `verify=False`.
"""
def __init__(self, url, login='', password='', token=''):
def __init__(self, url, login='', password='', token='', verify=True):
super(GitHubEnterprise, self).__init__(login, password, token)
self._session.base_url = url.rstrip('/') + '/api/v3'
self._session.verify = verify

def _repr(self):
return '<GitHub Enterprise [0.url]>'.format(self)
Expand Down
14 changes: 14 additions & 0 deletions tests/test_github.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import github3

from tests.utils import (BaseCase, load, mock)


Expand Down Expand Up @@ -852,6 +853,19 @@ def test_pubsubhubbub(self):
self.mock_assertions()


class TestUnsecureGitHubEnterprise(BaseCase):
def setUp(self):
super(TestUnsecureGitHubEnterprise, self).setUp()
self.g = github3.GitHubEnterprise('https://github.example.com:8080/', verify=False)

def test_skip_ssl_validation(self):
self.response('pull_enterprise')
self.g.pull_request('sigmavirus24', 'github3.py', 19)

assert False == self.g._session.verify
assert self.request.called


class TestGitHubStatus(BaseCase):
def setUp(self):
super(TestGitHubStatus, self).setUp()
Expand Down
0