A service which provides external schedules for consumption in IDP.
- Python 3.7.1 or greater
- Poetry
poetry install
poetry run uvicorn idp_schedule_provider.main:app
- Navigate to http://localhost:8000/docs
- Click on the
seed_data
api route - Click on
Try it out
- Click
Execute
It will take 5-10 seconds for the API call to complete and afterwars there will be a sqlite database created in the project directory (forecast_data.db). This database is rebuilt everytime the application restarts so you will need to reseed the test data everytime you restart the service.
At the time of writing this the database is getting seeded with the following test data
Scenario id | Data Start | Data End | Assets | Notes |
---|---|---|---|---|
sce1 | 2000-01-01T00:00:00Z | 2000-12-31T23:59:59Z | asset_1, asset_2, asset_3 | |
sce2 | N/A | N/A | N/A | sce2 is empty |
to enable the JWT Auth the environment variable AUTH
should be set to true.
The 3 forecaster APIs will then require a JWT token to be included in the authorization header.
AUTH=TRUE poetry run uvicorn idp_schedule_provider.main:app
You can get a JWT token by sending a post request to the token endpoint with the client_id and client_secret. This is a very insecure implementation of JWT and exists solely for testing purposes.
POST https://localhost:8000/token
Content-Type: application/x-www-form-urlencoded
client_id=gridos
client_secret=gridos_pw
and subsequent requests should include the token response in the authorization header
GET http://localhost:8000/scenarios
Content-Type: application/json
Authorization: Bearer <JWT Token>