TypeError:应为可读缓冲区对象

2024-03-28 12:29:25 发布

您现在位置:Python中文网/ 问答频道 /正文

当我尝试使用GET方法使用M2Crypto-HTTPSConnection库连接到API时,遇到以下错误。在

Traceback (most recent call last):
  File "osg-gridadmin-cert-request", line 665, in <module>
    status = check_quota_limit(request_count)
  File "osg-gridadmin-cert-request", line 543, in check_quota_limit
    conn.request('GET', arguments['quotaurl'], headers)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 941, in request
    self._send_request(method, url, body, headers)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 975, in _send_request
    self.endheaders(body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 937, in endheaders
    self._send_output(message_body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 801, in _send_output
    self.send(message_body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 773, in send
    self.sock.sendall(data)
  File "build/bdist.macosx-10.7-intel/egg/M2Crypto/SSL/Connection.py", line 217, in write
    return self._write_nbio(data)
  File "build/bdist.macosx-10.7-intel/egg/M2Crypto/SSL/Connection.py", line 202, in _write_nbio
    return m2.ssl_write_nbio(self.ssl, data)
TypeError: expected a readable buffer object

我正在使用以下代码访问API

^{pr2}$

你能帮我解决这个问题吗?在


Tags: inpyselfsendrequestliblinelibrary