Coder Social home page Coder Social logo

lark's Introduction

Lark is a RESTy interface for redis

https://api.travis-ci.org/voidfiles/lark.png

Lark is a python library that provides a generic method from transforming a HTTP request into a redis command. If you have heard of webdis this works in roughly the same way. It provides two main framework specific methods for Django, and Flask. Though it should be easy to fit Lark into any python web framework.

Features

  • Has a RESTy interface ie. POST for writes, GET for reads, and DELETE for, well, deletes
  • Automatic JSON serialization and deserialization for redis values
  • Automatic key prefixing for multi-user environments
  • Fully tested adapters for Flask and Django
  • Support for scope based authorization with an eye towards hooking up with flask-oauthlib
  • While rough, documentation is available for all supported methods

Quickstart

To get started make sure that you have redis installed, then install lark.

pip install lark

Next you can create a simple Flask app that mounts the lark blueprint. Lark also comes with a Redis middleware for setting up redis connections.

from flask import Flask
from lark.ext.flask.redis_api import redis_api_blueprint
from lark.ext.flask.flask_redis import Redis

app = Flask(__name__)
# Add a simple redis connection to the global object
Redis(app)

app.config['DEFAULT_LARK_SCOPES'] = set(['admin'])

# Mount the redis blueprint
app.register_blueprint(redis_api_blueprint, url_prefix='/api/0')


if __name__ == '__main__':
    app.run()

Now you can run the server and then you will be able to interact with the API like so. You can find documentation on all the calls here.

>>> curl http://127.0.0.1:5000/api/0/get/a/
{"meta": {"status": "ok", "status_code": 200}


>>> curl -X POST -H 'Content-Type: application/json' \
--data-ascii '{"value": "foo"}' \
http://127.0.0.1:5000/api/0/set/a/
"meta": {"status": "ok", "status_code": 200}, "data": true}

>>> curl http://127.0.0.1:5000/api/0/get/a/
{"meta": {"status": "ok", "status_code": 200}, "data": "foo"}

Planned Features

  • Flask middleware to support oauth2
  • A full Web interface for managing, and editing redis values.

lark's People

Contributors

pborreli avatar voidfiles avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lark's Issues

Redis cluster support

Do you plan supporting Redis Cluster?
That would be a great feature. And a good use of REST style.

Conflict with this package and lark-parser

This package is imported with lark and so is lark-parser. I think that we should change the import name from lark to lark-redis or something like that to prevent conflicts.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.