benoitc / benoitc/couchdbkit

BasicAuth CouchDB Example

Open
#136 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
263
Forks
90
PR merge metrics
No merged PRs in 30d

Description

I looked around before posting this, but if I missed it in the channel, group, or another ticket, I apologise.

I noticed there was no example for authentication (cf. BasicAuth) against CouchDB. I was thinking it might be nice to put an official example of using BasicAuth up in the docs. I assume what I worked out is right, but I'm filing this here because there may already be a cleaner way, or this may be less than efficient for some reason. (And this probably belongs in docs, not on the wiki, but I'm happy to put it there if it's a better idea)

``` python
import couchdbkit
from restkit import BasicAuth

uri = "http://127.0.0.1:5984/"
username = "CouchDBUsername"
password = "CouchDBPassword"

CouchDBAuth = couchdbkit.resource.CouchdbResource(filters=[BasicAuth(username, password)])
CouchDBServer = couchdbkit.Server(uri, resource_instance=CouchDBAuth)
```

As the function is already in restkit, I assume there's no reason to configure helpers/wrappers for CouchDB to do this, and I also assume that OAuth is similar (though I wouldn't know and can't test, I only use BasicAuth for CouchDB at the moment).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.