prestodb / presto-python-client

Python DB-API client for Presto

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Best way to ignore SSL verification?

mkapoor17 opened this issue · comments

I want to ignore SSL verification but not sure exactly how to do that. The complaint comes at cur.execute(query) and the error returned is

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='presto-dev.interactivedatastore.viasat.io', port=443): Max retries exceeded with url: /v1/statement (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)'),))

I know that that adding verify=False in the requests API generally resolves this issue but not sure how to incorporate that here.

@mkapoor17 what about:

with prestodb.dbapi.connect(
    host='localhost',
    port=8080,
    user='the-user',
    catalog='the-catalog',
    schema='the-schema',
    isolation_level=transaction.IsolationLevel.REPEATABLE_READ,
) as conn:
    conn._http_session.verify = False
    cur = conn.cursor()
    cur.execute(SQL)

@ggreg Awesome, worked like a charm, appreciate the help.