Skip to main content

Rethinkdb Mixin For Tornado Framework.

Project description

# torethink

Rethinkdb Mixin For Tornado Framework
**only Python 3.5 projects**

# Installation

**pip install torethink**


# Usage

```python
import tornado.web
import tornado.escape
...

from torethink import Torethink
...

class BaseHandler(tornado.web.RequestHandler):

async def prepare(self):
self.db = await Torethink.init(host="127.0.0.1", db="authentication", port=28015)

def write_json(self, obj):
self.set_header("Content-Type", "application/json; charset=UTF-8")
self.finish(tornado.escape.json_encode(obj))

class DemoHandler(BaseHandler):

async def get(self):
list = await self.db.list("user")
self.write_json({'users': list})

...
```

Project details


Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page