Multiple Python Version Installation- SSL issue

Teradata Database on VMWare
Highlighted
Teradata Employee

Multiple Python Version Installation- SSL issue

Hi All,

I am encountering  [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed error while executing a Google Analytics Script from TD 16.20 SLES 11 VM.

Currently, I have two versions of Python installed in my VM which are Python 2.6.9 and Python 3.4.5. I have provided detailed requirements and steps which I have followed. 

I would be grateful if you can help me to resolve this SSL certificate error.

 

Requirement: Install Python2.7.15 version onwards in Teradata SLES 11 VM for Extracting data from Google Analytics Python API Client and store Data into Teradata Database using Teradata Python Module

Environment: Teradata SLES 11 VM comes with preconfigured Python2.6.9 which does not support Teradata Python Module and Google Analytics Python Client. Only Python version 2.7.15 onwards support the mentioned libraries

Execution Steps: Execution of python Scripts to extract data from Google Analytics python3.4 HelloAnalytics.py

Execution Outcome:  SSL Certificate Error encountered while posting request to Google Analytics API

Error Stack: Below is the error stack encountered.

TDExpress1620_Sles11:/opt/teradata/Python3.4.5/CI # python3.4 HelloAnalytics.py

Traceback (most recent call last):

File "HelloAnalytics.py", line 165, in <module>

main(sys.argv)

File "HelloAnalytics.py", line 54, in main

scope='https://www.googleapis.com/auth/analytics.readonly')

File "/usr/local/lib/python3.4/site-packages/googleapiclient/sample_tools.py", line 99, in init

service = discovery.build(name, version, http=http)

File "/usr/local/lib/python3.4/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper

return wrapped(*args, **kwargs)

File "/usr/local/lib/python3.4/site-packages/googleapiclient/discovery.py", line 222, in build

requested_url, discovery_http, cache_discovery, cache)

File "/usr/local/lib/python3.4/site-packages/googleapiclient/discovery.py", line 269, in _retrieve_discovery_doc

resp, content = http.request(actual_url)

File "/usr/local/lib/python3.4/site-packages/oauth2client/transport.py", line 175, in new_request

redirections, connection_type)

File "/usr/local/lib/python3.4/site-packages/oauth2client/transport.py", line 282, in request

connection_type=connection_type)

File "/usr/local/lib/python3.4/site-packages/httplib2/__init__.py", line 1514, in request

(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)

File "/usr/local/lib/python3.4/site-packages/httplib2/__init__.py", line 1264, in _request

(response, content) = self._conn_request(conn, request_uri, method, body, headers)

File "/usr/local/lib/python3.4/site-packages/httplib2/__init__.py", line 1187, in _conn_request

conn.connect()

File "/usr/local/lib/python3.4/site-packages/httplib2/__init__.py", line 1013, in connect

self.sock = self._context.wrap_socket(sock, server_hostname=self.host)

File "/usr/local/lib/python3.4/ssl.py", line 362, in wrap_socket

_context=self)

File "/usr/local/lib/python3.4/ssl.py", line 580, in __init__

self.do_handshake()

File "/usr/local/lib/python3.4/ssl.py", line 807, in do_handshake

self._sslobj.do_handshake()

ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

 

I encounter the above Error whenever I try to interact with Google Analytics APIs.

 

Thanks!