This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Vinli platform auth wrapper for Tornado


pip install vinli-tornado-auth

Settings Requirements

Register and create an app at

In the app, create a web client type and take note of the following values:

  • vinli_client_id - App Client Id
  • vinli_client_secret - App Client Secret
  • vinli_redirect_uri - A valid URL to redirect to. eg: http://localhost:8000/auth/login

Add these values to application settings.

Example Usage

import tornado.escape
import tornado.ioloop
import tornado.gen
import tornado.web

from vinli_tornado_auth.auth import VinliAuthLoginMixin

class LoginHandler(tornado.web.RequestHandler, VinliAuthLoginMixin):
    Handle /auth/login
    def get(self):
        code = self.get_argument('code', None)
        if not code:
            yield self.authorize_redirect(
            access = yield self.get_authenticated_user(
            user = yield self.oauth2_request(
                'user', tornado.escape.json_encode({
                    'user': user,
                    'token': access['access_token']

class IndexHandler(tornado.web.RequestHandler, VinliAuthLoginMixin):
    Handle /
    def get_current_user(self):
        user = self.get_secure_cookie('user')
        if not user:
            return None
        return tornado.escape.json_decode(user)

    def get(self):
        devices = yield self.vinli_request(
            'platform', '/api/v1/devices',

class Application(tornado.web.Application):
    def __init__(self):
        settings = {
            'vinli_client_id': 'abc123',
            'vinli_client_secret': "shhhh it is secret",
            'vinli_redirect_uri': 'http://localhost:8000/auth/login',
            'cookie_secret': '12345',
        urls = [
            (r'/', IndexHandler),
            (r'/auth/login', LoginHandler),
        super(Application, self).__init__(urls, **settings)

if __name__ == '__main__':
    app = Application()

Making Authenticated Requests

Use the vinli_request method to make authenticated requests to the platform after initial authentication has been completed.

Get Trips for a device

As with the following example from the Vinli API Documentation, a list of trips for device id fe4bbc20-cc90-11e3-8e05-f3abac5b6b58 can be retrieved with the following:

def get(self):
    trips = yield self.vinli_request(
        'trips', '/api/v1/devices/fe4bbc20-cc90-11e3-8e05-f3abac5b6b58/trips',
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
vinli_tornado_auth-0.1.0.tar.gz (4.6 kB) Copy SHA256 Checksum SHA256 Source May 13, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting