Skip to main content

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

  1. Import the package
import mia_api
  1. Connect
mia_api.connect()

by default, the API stayed connected during 30 min.

  1. knowing all the bar availables
mybar=mia_api.JuiceBar('test') 
JuiceBar.available_bars()
  1. Get bar
mybar=mia_api.JuiceBar('MIABAR_stable_v1.2_tom3')
  1. knowing all juice availables
mybar.show_menu()
  1. Get juice
myjuice=mybar.get_juice('ons_VazaoNat_usinas')
  1. 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.4.tar.gz (6.7 kB view hashes)

Uploaded Source

Built Distribution

mia_api-0.0.4-py3-none-any.whl (7.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page