Skip to content

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

@afalk42

Description

@afalk42

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions