Skip to content
Ludwig Hülk edited this page Nov 7, 2019 · 18 revisions

DEPRECATED! This section will move to the OEP tutorial section!

Welcome to the oeplatform wiki!

This is the place to address your questions on how to use the OEP / oedb.


API

  • Q: How do I use the API?
  • A: Follow this instructions in order to setup up an environment to use the API tutorials
  1. Download and install Anaconda with Python 3

  2. Download the file requirement_oep-api.yml from this GitHub

    • By downloading the full repository in your Git
    • Or by: click on file -> click 'Raw' (located top left beside 'Blame' and 'History'. -> right click with mouse -> save site as ... -> select location and save
  3. Create a new conda environment using the file conda env create --name oep-api -f ENTER_PATH_HERE\requirement_oep-api.yml

  4. Activate the new env activate oep-api

  5. Register to the openmod Wiki and create an openmod profile

  6. Login on OEP and click your user name and receive your token

  7. Download the Jupyter Notebook Tutorials

    • By downloading the full repository in your Git (which you might already have done)
    • Or by: click on file -> click 'Raw' (located top left beside 'Blame' and 'History'. -> right click with mouse -> save site as ... -> select location and save
  8. Start a Jupyter Notebook with jupyter notebook

  9. Enjoy the API tutorials


  • Q:
  • A:
  • Source:

  • Q: How do we handle/store the token in a secure way?
  • A: We definitely should not hard code it in our python scripts and push it to GitHub. Concerning the question: since tokens are issued on a per user basis, each user can make his own choice of how to access it from his scripts using the API. When it comes to providing infrastructure on how to store it in code that is intended to use the API, IMHO the choice depends on the package providing the infrastructure. For oemof.db I would put a suggestion in the documentation to put the token, the path to the file containing the token or the service/username pair under which the token is stored in the keyring into the configuration file. For ego.io it looks like going with keyring is a good option if keyring is used by the package anyway. Just one thing: always provide a way to explicitly pass the key to functions using the API. That way the user has the choice of using the default way you want him to use, or he can use the way he prefers, like e.g. just reading it from a text file.
  • Source: https://github.com/openego/oeplatform/issues/240

Clone this wiki locally