Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes during developer day to get the examples to work #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions Python/01_connect.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import inspect
import os

from couchbase.client import Couchbase

from blessings import Terminal

import secret

t = Terminal()

os.system('clear')
Expand All @@ -16,18 +19,20 @@


# establish connection
couchbase = Couchbase("127.0.0.1:8091", "default", "")
couchbase = Couchbase(secret.HOSTPORT,
username=secret.USERNAME, password=secret.PASSWORD)

# set bucket object
cb = couchbase["default"]

print couchbase.servers

# establish connection to beer-sample
couchbase = Couchbase("127.0.0.1:8091", "beer-sample", "")
couchbase = Couchbase(secret.HOSTPORT,
username=secret.USERNAME, password=secret.PASSWORD)

# set bucket instance
beers = couchbase["beer-sample"]

print couchbase.servers
print
print
8 changes: 6 additions & 2 deletions Python/02_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
# -*- coding: utf-8 -*-

# sudo pip install blessings (for color terminal output)
import os
import os

from couchbase.client import Couchbase
from blessings import Terminal

import secret

t = Terminal()

os.system('clear')
Expand All @@ -15,7 +18,8 @@
print

# establish connection
couchbase = Couchbase("127.0.0.1:8091", "default", "")
couchbase = Couchbase(secret.HOSTPORT,
username=secret.USERNAME, password=secret.PASSWORD)

# connect to default bucket
cb = couchbase["default"]
Expand Down
13 changes: 8 additions & 5 deletions Python/03_storage_json.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import os
import json

from couchbase.client import Couchbase
from blessings import Terminal
import json
import hashlib

import secret

t = Terminal()

Expand All @@ -16,7 +18,8 @@
print

# establish connection
couchbase = Couchbase("127.0.0.1:8091", "default", "")
couchbase = Couchbase(secret.HOSTPORT,
username=secret.USERNAME, password=secret.PASSWORD)

# connect to default bucket
cb = couchbase["default"]
Expand Down Expand Up @@ -69,4 +72,4 @@

print
print t.bold_red("--------------------------------------------------------------------------")
print
print
13 changes: 8 additions & 5 deletions Python/04_retrieve.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#!/usr/bin/env python
# -*- coding" utf-8 -*-

import os
import os
import json

from couchbase.client import Couchbase
from blessings import Terminal
import json
import hashlib

import secret

# establish connection
couchbase = Couchbase("127.0.0.1:8091", "default", "")
couchbase = Couchbase(secret.HOSTPORT,
username=secret.USERNAME, password=secret.PASSWORD)

# connect to default bucket
cb = couchbase["default"]
Expand Down Expand Up @@ -112,4 +115,4 @@ def parse_json( val ):
#print


print t.bold_red("--------------------------------------------------------------------------")
print t.bold_red("--------------------------------------------------------------------------")
6 changes: 6 additions & 0 deletions Python/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
blessings==1.4
couchbase==0.8.2
requests==1.1.0
unittest2==0.5.1
uuid==1.30
wsgiref==0.1.2
13 changes: 13 additions & 0 deletions Python/secret.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4

# customize these variables for your deployment in your local.py

HOSTPORT = 'localhost:8081'
USERNAME = 'default'
PASSWORD = ''

try:
from local import *
except:
pass