连接到由sslerror返回的配置单元(sslerror(1,“[ssl:unknown\u protocol]unknown protocol(\u ssl.c:777))

zqry0prt  于 2021-06-26  发布在  Hive
关注(0)|答案(0)|浏览(507)

我有Windows2008ServerR2和Python3.6。尝试将客户端写入数据库配置单元。首先我写了

from pyhive import presto  # or import hive
cursor=presto.connect(host='namenode1', port=10000, username='tech_user', password='passsword1').cursor()
cursor.execute('select * from base1.change_cnt limit 10')
print(cursor.fetchone())
print(cursor.fetchall())

但返回错误

File "C:\Software\Python36\lib\site-packages\pyhive\presto.py", line 131, in __init__
    raise ValueError("Protocol must be https when passing a password")
ValueError: Protocol must be https when passing a password

我尝试更改addition attr protocol='https'

from pyhive import presto  # or import hive
cursor=presto.connect(host='namenode1', port=10000, protocol='https', username='tech_user', password='passsword1').cursor()
cursor.execute('select * from base1.change_cnt limit 10')
print(cursor.fetchone())
print(cursor.fetchall())

但返回了另一个错误

File "C:\Software\Python36\lib\site-packages\requests\api.py", line 58, in request
    return session.request(method=method, url=url,**kwargs)
  File "C:\Software\Python36\lib\site-packages\requests\sessions.py", line 508, in request
    resp = self.send(prep,**send_kwargs)
  File "C:\Software\Python36\lib\site-packages\requests\sessions.py", line 618, in send
    r = adapter.send(request,**kwargs)
  File "C:\Software\Python36\lib\site-packages\requests\adapters.py", line 506, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='namenode1', port=10000): Max retries exceeded with url: /v1/statement (Caused by SSLError(SSLError(1, '[SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:777)'),))

如何解决这个问题?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题