Skip to content

Instantly share code, notes, and snippets.

@0atman 0atman/
Last active Oct 9, 2017

What would you like to do?
A thin rest wrapper around a python shelf
#!/usr/bin/blaze pex flask flask-restful --
import shelve
from flask import Flask, request
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
with'ministore.db') as db:
class MiniStore(Resource):
def get(self, key):
return {key: db[key]}
def put(self, key):
db[key] = request.form['data']
return {key: db[key]}
api.add_resource(MiniStore, '/<string:key>')
if __name__ == '__main__':

This comment has been minimized.

Copy link
Owner Author

0atman commented Oct 9, 2017

To execute this script, use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.