A package to communicate with MIA API
Project description
mia_api
QuickStart
- If necessary you need insert PYTHONPATH variable in your bashrc
export PYTHONPATH='/home/user/scripts/mia_api:$PYTHONPATH'
First Login
- Create the file .mia_api in your home directory with your credentials sent to you by a mia_api admin
username: MIA_API_USERNAME
password: MIA_API_PASSWORD
- Alternatively you can set MIA_API_USERNAME and MIA_API_PASSWORD as environment variables
Using the API
- Import the package
import mia_api
- Connect
mia_api.connect()
by default, the API stayed connected during 30 min.
- knowing all the bar availables
mybar=mia_api.JuiceBar('test')
JuiceBar.available_bars()
- Get bar
mybar=mia_api.JuiceBar('MIABAR_stable_v1.2_tom3')
- knowing all juice availables
mybar.show_menu()
- Get juice
myjuice=mybar.get_juice('ons_VazaoNat_usinas')
- Select if you want a historical or operational juice
myjuice.historical() --> returns data xarray if dataset=True returns dataset
from datetime import datetime
myjuice.operational(rundate=datetime(2022,6,22,0,0,0))
myjuice.operational(rundate=[datetime(2022,6,1,0,0,0), datetime(2022,6,22,0,0,0)])
myjuice.operational()
Function
Soon there will by examples
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mia_api-0.0.3.tar.gz
(6.6 kB
view hashes)