prestodb / presto-python-client

Python DB-API client for Presto
Apache License 2.0
239 stars 87 forks source link

Best way to ignore SSL verification? #85

Closed mkapoor17 closed 5 years ago

mkapoor17 commented 5 years ago

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.

ggreg commented 5 years ago

@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)
mkapoor17 commented 5 years ago

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