GithubHelp home page GithubHelp logo

flask-api's Introduction

Flask API

This is Flask framework based api. There must sqlite db installed in your linux system also some virtualenv activated. Clone this rep.

git clone [email protected]:kukirokuk/flask-api.git

Then run:

pip install -t requirements.txt

Next:

python

This create new sqlite database:

>>> from api import db
>>> db.create_all()

And finally start server:

python run.py

If you are runing this app on local host than it will be available on this url http://0.0.0.0:8080 You can interact with it both with frontend web page and json request. To use its frontend web pages you need to login here http://<your_host>:<your_port>/login. Afteer login you willl be able visit its pages, submit keys, values and get values http://<your_host>:<your_port>/get, http://<your_host>:<your_port>/set. To interact with this API you can also make authenticated requests. There two auth ways available. The first you need to register here http://<your_host>:<your_port>/register to get your credentials and then provide them in url params http://<your_host>:<your_port>/get/<key>?username=<your_username>&api_key=<your_password>. The second way you can use basic authentication via http headers. You should provide your username and password for every request to API. Example of get request with url params authentication http://0.0.0.0:8080/get/some_key?username=new_user&api_key=secret_key. In response you should receive json:

{
    "key": "some_key",
    "user_id": 1,
    "value": "some_value"
}

To make a set request you should provide a json body for request http://0.0.0.0:8080/set/?username=new_user&api_key=secret_key:

{
	"key": "new_key",
	"value": "new_value"
}

To run tests:

python tests.py

flask-api's People

Contributors

kukirokuk avatar foobar123asdf avatar

Watchers

 avatar

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.