Giter Club home page Giter Club logo

Comments (8)

djc avatar djc commented on July 26, 2024

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 Resource._request_json() seems to imply that if the Content-Type includes application/json, the response content (which could well be a BytesIO) should get decoded into a dictionary.

from couchdb-python.

jat255 avatar jat255 commented on July 26, 2024

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"
}
}

from couchdb-python.

jat255 avatar jat255 commented on July 26, 2024

Debugging it a bit, the data value (https://github.com/djc/couchdb-python/blob/master/couchdb/client.py#L511) is indeed a BytesIO, with html content showing a 301 response:

<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')]

from couchdb-python.

djc avatar djc commented on July 26, 2024

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.

from couchdb-python.

jat255 avatar jat255 commented on July 26, 2024

I updated my above comment with the response. From what I can tell, PouchDB provides a CouchDB-compliant RESTful API

from couchdb-python.

djc avatar djc commented on July 26, 2024

So the Content-Type is wrong, this is why it doesn't work.

from couchdb-python.

jat255 avatar jat255 commented on July 26, 2024

The same commands work if I manually do a put request using requests, so I believe this is a bug with the library. Since you closed the issue, I take that to mean you don't have an interest in fixing it?

from couchdb-python.

djc avatar djc commented on July 26, 2024

The Content-Type being set to application/json is, for all intents and purposes, part of the CouchDB API contract. As your setup doesn't seem to comply with that API contract, yes, I don't think it makes sense to change couchdb-python to make your setup work.

from couchdb-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.