gpt4 book ai didi

Python SSL错误解密失败或坏记录mac

转载 作者:行者123 更新时间:2023-12-03 17:28:24 25 4
gpt4 key购买 nike

我正在尝试使用 gspread python 模块来读取谷歌电子表格。但是我从 ssl 收到一些错误。我试图对此进行调查,但无法使其发挥作用。 gspread 模块正在使用 python request在内部,这似乎是使用 python 的 ssl 包。下面提供了代码(我已经编写)和堆栈跟踪以及环境详细信息。

环境:

  • python :2.7.13
  • Ubuntu:14.04
  • openssl:1.0.1f 2014 年 1 月 6 日

  • 代码:
    import gspread
    from oauth2client.client import SignedJwtAssertionCredentials

    scope = ['https://spreadsheets.google.com/feeds']
    credentials = SignedJwtAssertionCredentials(user_email, private_key, scope)
    google_client = gspread.authorize(credentials)


    worksheet = google_client.open_by_url(<worksheet_url>).get_worksheet(1)

    list_of_rows = worksheet.get_all_values()

    print list_of_rows

    堆栈跟踪:
    File "<console>", line 1, in <module>
    File "/home/nikhil/.venv/nikhil/src/gspread/gspread/models.py", line 344, in get_all_values
    cells = self._fetch_cells()
    File "/home/nikhil/.venv/nikhil/src/gspread/gspread/models.py", line 231, in _fetch_cells
    feed = self.client.get_cells_feed(self)
    File "/home/nikhil/.venv/nikhil/src/gspread/gspread/client.py", line 186, in get_cells_feed
    r = self.session.get(url)
    File "/home/nikhil/.venv/nikhil/src/gspread/gspread/httpsession.py", line 76, in get
    return self.request('GET', url, **kwargs)
    File "/home/nikhil/.venv/nikhil/src/gspread/gspread/httpsession.py", line 68, in request
    response = func(url, data=data, headers=request_headers, verify=False)
    File "/home/nikhil/.venv/nikhil/lib/python2.7/site-packages/requests/sessions.py", line 469, in get
    return self.request('GET', url, **kwargs)
    File "/home/nikhil/.venv/nikhil/lib/python2.7/site-packages/requests/sessions.py", line 457, in request
    resp = self.send(prep, **send_kwargs)
    File "/home/nikhil/.venv/nikhil/lib/python2.7/site-packages/requests/sessions.py", line 606, in send
    r.content
    File "/home/nikhil/.venv/nikhil/lib/python2.7/site-packages/requests/models.py", line 724, in content
    self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
    File "/home/nikhil/.venv/nikhil/lib/python2.7/site-packages/requests/models.py", line 653, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
    File "/home/nikhil/.venv/nikhil/lib/python2.7/site-packages/requests/packages/urllib3/response.py", line 256, in stream
    data = self.read(amt=amt, decode_content=decode_content)
    File "/home/nikhil/.venv/nikhil/lib/python2.7/site-packages/requests/packages/urllib3/response.py", line 186, in read
    data = self._fp.read(amt)
    File "/usr/local/lib/python2.7.13/lib/python2.7/httplib.py", line 573, in read
    return self._read_chunked(amt)
    File "/usr/local/lib/python2.7.13/lib/python2.7/httplib.py", line 642, in _read_chunked
    value.append(self._safe_read(chunk_left))
    File "/usr/local/lib/python2.7.13/lib/python2.7/httplib.py", line 688, in _safe_read
    chunk = self.fp.read(min(amt, MAXAMOUNT))
    File "/usr/local/lib/python2.7.13/lib/python2.7/socket.py", line 384, in read
    data = self._sock.recv(left)
    File "/usr/local/lib/python2.7.13/lib/python2.7/ssl.py", line 766, in recv
    return self.read(buflen)
    File "/usr/local/lib/python2.7.13/lib/python2.7/ssl.py", line 653, in read
    v = self._sslobj.read(len)
    SSLError: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:1864)

    任何帮助将非常感激。

    更新:
    我已经在新机器上从头开始设置了所有内容,还更新了 oauth 客户端以使用新的 API 版本。无法使上述环境工作,所以暂时保持这个问题开放。

    最佳答案

    我在 Wifi 上,它发生在我身上。我用以太网电缆插入计算机,它为我解决了这个问题。

    关于Python SSL错误解密失败或坏记录mac,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41780517/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com