GithubHelp home page GithubHelp logo

hod101s / flask-books-api-with-jwt Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 445 KB

Flask API with JWT Authentication + Dynamo Db CRUD

Python 53.75% HTML 45.88% Batchfile 0.38%
jwt flask jwt-authentication dynamodb dynamodb-local

flask-books-api-with-jwt's Introduction

Flask API :

Made for ECS backend cloud developer test

Setup

  1. Run startDynamo.bat : starts local dynamodb
  2. Run import_data.py and import_users.py from dynamo_db_schema to create required tables and import necessary data

Usage Example

1. Call login

Send username and password POST params. If no user created manually use :- username:User1 & password:pass1. On successful login you will be issued an API token. This is valid for 15 minutes.

3. Or use add_user endpoint to add user

http://127.0.0.1:5000/add_user?username=User3&password=pass3

4. Call any endpoint

example 1:

url: http://127.0.0.1:5000/add_book/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6IlVzZXIxIiwiaWQiOiI0MWUzY2RmMzExYzQ0N2YzOWY3YjlkOGZiOGI4NGUyMiIsImV4cCI6MTYxMTIzNDgyNn0.dkbBqU7Azh8UkC9QTc-qjrnB-G6TJhlg6CKZ9MO07D0

with POST params
addtitle:dummyTitle
addauthor:leAuthor
addrating:123
addisbn:12321312
addlangcode:eng
addratingcount:123124
addprice:10

example 2:

http://127.0.0.1:5000/get_book/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6IlVzZXIxIiwiaWQiOiI0MWUzY2RmMzExYzQ0N2YzOWY3YjlkOGZiOGI4NGUyMiIsImV4cCI6MTYxMTIzODI4Mn0.BReOsvw0oqdDtT5z5WTLo1s0bzorR--ED_KsXaU8IPk?bookID=6

Refer API Documentation for API usage

Testing

run :

python unit_test_cases/tests.py

flask-books-api-with-jwt's People

Contributors

hod101s avatar

Stargazers

 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.