rossmacarthur / stow

:closed_lock_with_key: An example Flask app to securely PUT and GET data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

stow

A Flask app to securely PUT and GET data.

This app was developed as a learning endeavor, in order to learn about Flask and various other packages in the Flask ecosystem.

In this example the following packages are used:

Getting started

Clone the repository

git clone git@github.com:rossmacarthur/stow.git && cd stow

Create a virtualenv using pyenv or similar, you will need to use Python 3.6 or later

pyenv virtualenv stow
pyenv local stow

Then inside the virtual environment install the app

make install-dev

Create the database and run all migrations

make migrate

Finally run the development server

make run

Stow will then be available at http://localhost:5001! 🎉

API

To store <value> under the key <key> you must PUT to /api/stow/<key> with:

{
    "value": "some interesting secret data"
}

You can then GET from /api/stow/<key> to retrieve:

{
    "value": "some interesting secret data",
    "modified": "2018-03-10T10:25:35.576296",
    "created": "2018-03-10T10:25:35.576296"
}

Of course to do the above you need to provide authorization. You must first register a user by POST to /api/user with:

{
    "name": "John Smith",
    "password": "secret1234"
}

You can then use HTTP Basic Auth with the name and password. Or if you prefer you can request a token from /api/token and use this as the HTTP Basic Auth username (in this case the password can be left blank or set to an arbitrary value). The token will last for an hour.

License

This project is licensed under the MIT License. See the LICENSE file.

About

:closed_lock_with_key: An example Flask app to securely PUT and GET data

License:MIT License


Languages

Language:Python 61.2%Language:HTML 33.5%Language:Makefile 3.9%Language:Mako 1.2%Language:Shell 0.2%