项目作者: HOD101s

项目描述 :
Flask API with JWT Authentication + Dynamo Db CRUD
高级语言: Python
项目地址: git://github.com/HOD101s/Flask-Books-API-with-JWT.git
创建时间: 2021-01-27T16:03:38Z
项目社区:https://github.com/HOD101s/Flask-Books-API-with-JWT

开源协议:

下载


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

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

4. Call any endpoint

example 1:

  1. url: http://127.0.0.1:5000/add_book/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6IlVzZXIxIiwiaWQiOiI0MWUzY2RmMzExYzQ0N2YzOWY3YjlkOGZiOGI4NGUyMiIsImV4cCI6MTYxMTIzNDgyNn0.dkbBqU7Azh8UkC9QTc-qjrnB-G6TJhlg6CKZ9MO07D0
  2. with POST params
  3. addtitle:dummyTitle
  4. addauthor:leAuthor
  5. addrating:123
  6. addisbn:12321312
  7. addlangcode:eng
  8. addratingcount:123124
  9. addprice:10

example 2:

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

Refer API Documentation for API usage

Testing

run :

  1. python unit_test_cases/tests.py