This repository was archived by the owner on Jan 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
This repository was archived by the owner on Jan 24, 2023. It is now read-only.
ValueError: check_hostname needs a SSL context with either CERT_OPTIONAL or CERT_REQUIRED #4
Copy link
Copy link
Open
Description
Running on ubuntu 14.0.4
Using the google-api-python-client and httplib2shim.
Runs fine on my mac.
Raised the following on ununtu:
Traceback (most recent call last):
File "checkGoogle.py", line 10, in <module>
from contentCalls import GoogleContentCalls
File "/home/sofia/google-api-v2/apiv2/contentCalls.py", line 80, in <module>
service = build('content', 'v2', http=auth_http, developerKey=credentials.access_token)
File "/home/sofia/virtualenv/googleapiv2/lib/python3.4/site-packages/oauth2client/util.py", line 140, in positional_wrapper
return wrapped(*args, **kwargs)
File "/home/sofia/virtualenv/googleapiv2/lib/python3.4/site-packages/googleapiclient/discovery.py", line 222, in build
cache)
File "/home/sofia/virtualenv/googleapiv2/lib/python3.4/site-packages/googleapiclient/discovery.py", line 269, in _retrieve_discovery_doc
resp, content = http.request(actual_url)
File "/home/sofia/virtualenv/googleapiv2/lib/python3.4/site-packages/oauth2client/client.py", line 596, in new_request
redirections, connection_type)
File "/home/sofia/virtualenv/googleapiv2/lib/python3.4/site-packages/newrelic-2.74.0.54/newrelic/api/external_trace.py", line 103, in dynamic_wrapper
return wrapped(*args, **kwargs)
File "/home/sofia/virtualenv/googleapiv2/lib/python3.4/site-packages/httplib2/__init__.py", line 1196, in request
self.disable_ssl_certificate_validation)
File "/home/sofia/virtualenv/googleapiv2/lib/python3.4/site-packages/httplib2/__init__.py", line 850, in __init__
check_hostname=True)
File "/usr/lib/python3.4/http/client.py", line 1250, in __init__
raise ValueError("check_hostname needs a SSL context with "
ValueError: check_hostname needs a SSL context with either CERT_OPTIONAL or CERT_REQUIRED
I have the following in my code:
http = httplib2shim.Http()
http.disable_ssl_certificate_validation = True
I've tried:
http = httplib2shim.Http(disable_ssl_certificate_verification=True)
I've tried editing the httplib2shim library as follows:
def _default_make_pool(http):
"""Creates a urllib3.PoolManager object that has SSL verification enabled
and uses the certifi certificates."""
if not http.ca_certs:
http.ca_certs = _certifi_where_for_ssl_version()
ssl_disabled = http.disable_ssl_certificate_validation
cert_reqs = 'CERT_OPTIONAL'
Can someone let me know how to resolve this issue.
Its cropped up with httplib2 before - and these have been the suggested work arounds, but its not working on an ubuntu/httplib2shim combination.
I'm using the shim as it resolved my broken pipes with batch processing on theh google content api.
Thanks
Alex
Metadata
Metadata
Assignees
Labels
No labels