Skip to content

Latest commit

 

History

History
78 lines (64 loc) · 3.41 KB

README.md

File metadata and controls

78 lines (64 loc) · 3.41 KB

Grid load simulation API

Build badgecoverage badgeissues badgelicense badge

Grid load simulation REST API based on Pandapower

docker run -p 80:80 pauldepraz/pandapowerapi

Once running click here to access the Swagger UI to interact with the API.

Alternatively, interact with the API use Insomnia.rest and import the Insomnia Workspace from the docs/ folder to hit the ground running!

Alternatively, use curl or httpie on the cmd.

http 127.0.0.1/api/v1/simulations
http 127.0.0.1/api/v1/simulation/0/load/active
http 127.0.0.1/api/v1/simulation/0/load/reactive
http post 127.0.0.1/api/v1/simulations
http 127.0.0.1/api/v1/simulation/1
http delete 127.0.0.1/api/v1/simulation/0
http 127.0.0.1/api/v1/simulation/0
http post 127.0.0.1/api/v1/simulations active=0.6 reactive=0.9
http post 127.0.0.1/api/v1/simulations active=0.2 reactive=0.01
http put 127.0.0.1/api/v1/simulation/2 active=0.2 reactive=0.05
http 127.0.0.1/api/v1/simulation/2/load/active
http 127.0.0.1/api/v1/simulation/2/load/reactive

Continuous integrations

Running on a local machine

Run on the already installed Gunicorn wsgi server.

virutalenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txt
gunicorn -b 0.0.0.0:80 api.server:rest

For wsgi alternatives check Flask documentation here.

Running the tests

These commands will run all the tests, static analysis, code audit and display coverage.

Powered by pytest test framework, pylama code audit tool, and coveragepy.

coverage run -m pytest --pylama && coverage report && coverage-badge -o docs/coverage.svg

Building a Docker container

Build a local docker image.

docker build -t pauldepraz/pandapowerapi -f Dockerfile.alpine .

Run the container and map the internal ports to host.

docker run -p 80:80/tcp pauldepraz/pandapowerapi

Links