The Couch
class in the example does not pass any authentication information to the database, so it is not a miracle that it does not allow privileged operations. So your only options are:
- disable authentication completely (as you mentioned)
- pass the user name and password as part of the URI
- pass the user name and password as an
Authorization
HTTP request header
If you want to pass a user name and a password, then you will need to change the Couch
class. Sending an Authorization
HTTP request header is easier, since the Couch class uses the httplib.HTTPConnection
class. You can add such a header next to the Accept
one this way:
headers = {
"Accept": "application/json",
"Authorization": "Basic " + 'username:password'.encode('base64')[:-1]}
Same for the other HTTP request methods.
The documentation on the basic authentication is here:
http://books.couchdb.org/relax/reference/security