Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

couchbase perf tests

View test_add_cb.py
1 2 3 4 5 6 7 8 9 10 11
from couchbase.client import Couchbase
 
 
def insert_doc():
couchbase = Couchbase("localhost:8091", "account", "")
bucket = couchbase["account"]
key = "test_key"
val = "test_val"
bucket.set(key, 0, 0, val)
 
insert_doc()
View test_add_cb.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
import httplib2
import json
 
 
def insert_doc():
http = httplib2.Http()
http.add_credentials("Administrator", "password")
doc_name = "mydoc"
url = 'http://127.0.0.1:8092/account/%s' % doc_name
doc = {"doc_foo": "foo", "doc_bar": "bar"}
body = json.dumps(doc, sort_keys=True, indent=4)
response, content = http.request(
url,
'PUT',
body,
headers={'Content-type': 'application/json'}
)
 
insert_doc()
View test_add_cb.py
1 2 3 4 5 6 7 8 9
from couchbase.client import Couchbase
 
 
def get_doc():
couchbase = Couchbase("localhost:8091", "account", "")
bucket = couchbase["account"]
bucket.get("test_key")
 
get_doc()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.