Skip to content

Instantly share code, notes, and snippets.

@mnunberg
Created February 7, 2014 21:05
Show Gist options
  • Save mnunberg/8871828 to your computer and use it in GitHub Desktop.
Save mnunberg/8871828 to your computer and use it in GitHub Desktop.
Manually getting a view result via the Python SDK
#!/usr/bin/env python
from random import choice
import requests
from couchbase import Couchbase
from couchbase.views.params import Query
cb = Couchbase.connect(bucket='beer-sample')
node = choice(cb.server_nodes).replace("8091", "8092")
q = Query()
q.limit = 5
q.reduce = True
uri = "http://{0}/{1}/_design/beer/_view/by_location?{2}".format(
node, cb.bucket, q.encoded)
print uri
resp = requests.get(uri)
print resp.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment