-
Notifications
You must be signed in to change notification settings - Fork 86
'_io.BytesIO' object is not subscriptable
when creating new document
#315
Comments
Hmm, this is kind of weird. What version of CouchDB this is? Can you somehow get the exact response, headers and content, on the HTTP level? The code in |
The db is actually a pouchDB, but I think that should be okay. The server replies that it is version 2.0.0: {
couchdb: "Welcome",
version: "2.0.0",
vendor: {
name: "The Apache Software Foundation"
}
} |
Debugging it a bit, the <html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html> And here's the header content (url removed): > headers.items()
[('Server', 'nginx'),
('Date', 'Sun, 19 Mar 2017 19:25:17 GMT'),
('Content-Type', 'text/html'),
('Content-Length', '178'),
('Connection', 'keep-alive'),
('Location',
'https://xxxx')] |
I still really want to know the exact HTTP response, including headers. Also, the welcome object you're showing doesn't look like PouchDB, and I'm pretty sure PouchDB does not offer a HTTP API in any case. |
I updated my above comment with the response. From what I can tell, PouchDB provides a CouchDB-compliant RESTful API |
So the Content-Type is wrong, this is why it doesn't work. |
The same commands work if I manually do a put request using |
The |
I'm trying to create a new document on a CouchDB server.
The simple example from the documentation works fine:
userdb.save({'type': 'Person', 'name': 'John Doe'})
But if I try to do a realistic example, where I need to set the
_id
value to a custom name (for the application to use), I get an error:Error:
This looks like a Python 3 string encoding error, perhaps? Any thoughts?
The text was updated successfully, but these errors were encountered: