Created
April 2, 2013 12:49
-
-
Save codersofthedark/5291969 to your computer and use it in GitHub Desktop.
Couchbase and Twisted
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twisted.web import server, resource | |
from twisted.internet import reactor | |
from couchbase.client import Couchbase | |
couchbase = Couchbase("ubuntumartini03:8091", "martini-tag-manager", "") | |
bucket = couchbase["martini-tag-manager"] | |
class HelloResource(resource.Resource): | |
isLeaf = True | |
def render_GET(self, request): | |
#query = self.get_argument("pub_id", strip=True) | |
data = bucket.get("00000001-Top")[2] | |
result = json.loads(data) | |
request.setHeader("content-type", "text/plain") | |
return result['metaTag'] | |
reactor.listenTCP(8080, server.Site(HelloResource())) | |
reactor.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment