diff --git a/Python/01_connect.py b/Python/01_connect.py index 73d8bc7..608a880 100644 --- a/Python/01_connect.py +++ b/Python/01_connect.py @@ -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') @@ -16,7 +19,8 @@ # 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"] @@ -24,10 +28,11 @@ 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 \ No newline at end of file +print diff --git a/Python/02_storage.py b/Python/02_storage.py index 814e305..c502599 100644 --- a/Python/02_storage.py +++ b/Python/02_storage.py @@ -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') @@ -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"] diff --git a/Python/03_storage_json.py b/Python/03_storage_json.py index a7c7eb1..2c30b09 100644 --- a/Python/03_storage_json.py +++ b/Python/03_storage_json.py @@ -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() @@ -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"] @@ -69,4 +72,4 @@ print print t.bold_red("--------------------------------------------------------------------------") -print \ No newline at end of file +print diff --git a/Python/04_retrieve.py b/Python/04_retrieve.py index 5ff4b97..ab4bf73 100644 --- a/Python/04_retrieve.py +++ b/Python/04_retrieve.py @@ -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"] @@ -112,4 +115,4 @@ def parse_json( val ): #print -print t.bold_red("--------------------------------------------------------------------------") \ No newline at end of file +print t.bold_red("--------------------------------------------------------------------------") diff --git a/Python/requirements.txt b/Python/requirements.txt new file mode 100644 index 0000000..91a8690 --- /dev/null +++ b/Python/requirements.txt @@ -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 diff --git a/Python/secret.py b/Python/secret.py new file mode 100644 index 0000000..cd74375 --- /dev/null +++ b/Python/secret.py @@ -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