Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

TypeError: 'ResponseBody' object is not subscriptable #281

@guyskk

Description

@guyskk

I use db.save(doc), it cause error sometimes:

File "/usr/lib/python3.5/site-packages/couchdb/client.py", line 440, in save
    id, rev = data['id'], data.get('rev')
TypeError: 'ResponseBody' object is not subscriptable

and I try to find the reason, in http.py:

369             # Buffer small non-JSON response bodies
370             elif int(resp.getheader('content-length', sys.maxsize)) < CHUNK_SIZE:
371                 data = resp.read()
372                 self.connection_pool.release(url, conn)
373     
374             # For large or chunked response bodies, do not buffer the full body,
375             # and instead return a minimal file-like object
376             else:
377 B->             data = ResponseBody(resp, self.connection_pool, url, conn)
378                 streamed = True

when resp's content-length > CHUNK_SIZE, it will cause error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions