Skip to content

tibor-reiss/avagps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Avast homework

This is a simple flask app with 3 endpoints:

  • /ping -> returns "Alive" and current time
  • /v1/now -> returns json, e.g. {'now": }
  • /v1/VIP/ -> returns either
    • after more than 5 sec: TIMEOUT
    • if there is a db error: ERROR
    • in normal operation a json, e.g. {"gpsCoords":{"lat":77.77449,"long":106.75767},"source":"vip-db"}

A log file is generated in the current directory. The log will contain a periodic heartbeat for each worker and timeout/error messages.

Installation

$ python3 -m venv <your_virtual_environment>
$ source <your_virual_environment>/bin/activate
$ git clone [email protected]:tibor-reiss/avagps.git <new_folder>
$ cd <new_folder>
$ python3 -m pip install -e .

Start the app

Logging location: avagps.log

Development

flask run

Production

gunicorn -b localhost:<port> -w <workers> src.wsgi:app

Usage

From browser:

  • http://localhost:5000/ping
  • http://localhost:5000/v1/now
  • http://localhost:5000/v1/VIP/<integer>

From command line:

    curl -X GET http://localhost:5000/ping
    curl -X GET http://localhost:5000/v1/now
    curl -X GET http://localhost:5000/v1/VIP/<integer>

Testing

pytest
pytest --cov=src

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published