GithubHelp home page GithubHelp logo

d-e-h-i-o / insuranceapi Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 5.45 MB

A Flask application that provides an API for insurance recommendations. Supports authentification. This project was part of a job application process.

License: MIT License

Python 98.46% Mako 1.54%
flask api

insuranceapi's Introduction

insuranceAPI

image

This is an insurance recommendation API. A user can register, login, logout, and post questionnaire data for which he will get a set of insurance recomendation as response.

API usage

The app ist currenty hosted and accessible at http://insurance-agent.store. It is hosted on a Heroku dyno, so it might take some time for startup at the first request.

Important: The connection is not SSL/TLS encrypted, so do not send any personal information or passwords you use at other services. The endpoint is just for demonstration purposes. Also please understand that the API results are not an official consultation and just used for information purposes.

Register

POST to http://insurance-agent.store/register with JSON-payload:

{
	"username": <username>,
	"email": <email>,
	"password": <password>
}

Get a recommendation

POST to http://insurance-agent.store/recommendation with JSON-payload:

{
  "first_name": <firstname>,
  "address": <address>,
  "occupation": <occupation>, (in {Employed, Student, Self-employed})
  "email_address": <email>,
  "children": <Boolean>,
  "num_children": <int> (optional)
}

Login/Logout

The app also supports login ({"username": <username>, "password": <password>}) at http://insurance-agent.store/login and logout at http://insurance-agent.store/logout. Registering will automatically log you in.

Run the app locally

  1. Clone repository
    git clone https://github.com/d-e-h-i-o/insuranceAPI.git
    cd insuranceAPI/
  2. Create virtual environment
    python3 -m venv venv
  3. Activate virtual environment
    source venv/bin/activate
  4. Install requirements
    pip install -r requirements.txt
  5. Set environment variables
    export DATABASE_URL="postgresql:///insuranceapi_dev"
    export APP_SETTINGS="config.DevelopmentConfig"
    export FLASK_APP="api_app:create_app()"
    export SECRET_KEY=<something_really_secret>
  6. Set up database
    createdb insuranceapi_dev
  7. Run app
    flask run

Run test suite

  1. Set up database
    createdb insuranceapi_test
  2. Run tests
    python -m pytest tests/ --capture=tee-sys

Todo

  • Integrate JWT
  • Integrate Flask-Admin
  • Use mypy and type hints
  • Use docker

insuranceapi's People

Contributors

d-e-h-i-o 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.