Skip to content
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

ValueError: check_hostname needs a SSL context with either CERT_OPTIONAL or CERT_REQUIRED #53

Closed
afalk42 opened this issue Apr 7, 2015 · 2 comments

Comments

@afalk42
Copy link

afalk42 commented Apr 7, 2015

I just upgraded from v201409 to v201502 by running pip install --upgrade googleads and without doing any other changes, I suddenly can no longer use any of the googleads services. Any call, for example, to get a list of all campaigns, now results in a ValueError exception inside the http lib, where it claims it needs an SSL context with either CERT_OPTIONAL or CERT_REQUIRED?

DEBUG:suds.transport.http:opening (https://adwords.google.com/api/adwords/cm/v201502/CampaignService?wsdl)
INFO:oauth2client.client:Refreshing access_token
Traceback (most recent call last):
   ...
    page = campaign_service.get(selector)
  File "C:\Python34\lib\site-packages\googleads\common.py", line 294, in MakeSoapRequest
    self._header_handler.SetHeaders(self.suds_client)
  File "C:\Python34\lib\site-packages\googleads\adwords.py", line 378, in SetHeaders
    headers=self._adwords_client.oauth2_client.CreateHttpHeader())
  File "C:\Python34\lib\site-packages\googleads\oauth2.py", line 150, in CreateHttpHeader
    self.Refresh()
  File "C:\Python34\lib\site-packages\googleads\oauth2.py", line 166, in Refresh
    self.disable_ssl_certificate_validation)))
  File "C:\Python34\lib\site-packages\oauth2client\client.py", line 577, in refresh
    self._refresh(http.request)
  File "C:\Python34\lib\site-packages\oauth2client\client.py", line 748, in _refresh
    self._do_refresh_request(http_request)
  File "C:\Python34\lib\site-packages\oauth2client\client.py", line 777, in _do_refresh_request
    self.token_uri, method='POST', body=body, headers=headers)
  File "C:\Python34\lib\site-packages\httplib2\__init__.py", line 1174, in request
    self.disable_ssl_certificate_validation)
  File "C:\Python34\lib\site-packages\httplib2\__init__.py", line 829, in __init__
    check_hostname=True)
  File "C:\Python34\lib\http\client.py", line 1211, 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'm running Python 3.4 on Windows with not much installed in terms of other packages. The output from pip list is:

feedparser (5.1.3)
googleads (3.2.0)
httplib2 (0.9)
oauth2client (1.4.7)
oauthlib (0.7.2)
pip (6.1.1)
pyasn1 (0.1.7)
pyasn1-modules (0.0.5)
pyodbc (3.0.7)
PySocks (1.5.3)
pytz (2015.2)
PyYAML (3.11)
rsa (3.1.4)
setuptools (15.0)
six (1.9.0)
suds-jurko (0.6)
@afalk42
Copy link
Author

afalk42 commented Apr 7, 2015

Update: after doing further research and trying to reproduce this on another machine, I realized that the same error doesn't occur on a clean install. I went ahead, uninstalled Python 3.4.1 from my main dev machine, deleted the C:\Python34 directory in its entirety, did a clean fresh install of Python 3.4.3 and installed the googleads library and everything is working nicely again.

@afalk42 afalk42 closed this as completed Apr 7, 2015
@lucasdavid
Copy link

I can't simply reinstall Python, as I'm on Ubuntu and there are many packages that depend on it. Instead, I modified httplib2/__init__.py file as done in this pull request, and it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants