Market Example - AtherActive/EVEPy Wiki

So, you want to implement the market module? Here is how!

  1. Import EVEPy in your project. Drop the contents inside a folder called EVEPy.
  2. Create a new python file in your MAIN project directory. I will be calling it market.py.
  3. Now it is time to import some data! You will need to import main and terminal_messages for this. Here is how!

In my case I have given them simpler names. This is not required, but recommended. This tutorial will use the simplified names.

  1. Now, in order to use the required data, we need to import the CSV file EVEPy has. We will be creating a PRE function to do this.

Function

  1. Now that we imported some required data, let's start using the PullDataFromAPI() function! For this we will need to get an Input form the user (the item name) and try finding it. Here is how we do it. (Image below)
    1. Create a function called "app_start". It has no arguments.
    2. Add a print statement there. In the content, put "msg.startup" (not in quotes, but as a Var)
    3. Create a Var "name". In here we will store our Input value. The Value of this Var will be "input(msg.inputValue)" (No quotes).
    4. Add a print statement with the Value "msg.loading". We will come back later to this to print the actual data. You should end up with something like this:

  1. Now that we have the basic functions set up, it is time to actually start using this data. For this we will need to create a special function printing the data and formatting it. * NOTE: This will be shown in an image, as it is mostly formatting some text, which is entirely up to you on how you use it.

  1. Alright, so you got that too. Now it is time to go back to the "app_start" function and we can finish it.
    1. After the loading print statement, add "try:"
    2. Inside the "try:", put "PrintData(name)". This is the print function we just created.
    3. Now go back to the indent from the "app_start" function. Now add "except:" . (Due to the basic nature it will be a general exception handler)
    4. Inside the "except:" put a "print('An Error Occured')" statement with the value as seen there.
    5. Under this print statement add "app_start()". This will restart the app.

  1. At the very bottom of the file (not inside a function), add "app_pre()". On the line beneath that, add "app_start".

And here you have a very basic script that pulls market data from an input! You can also take a look at this file (a more advanced version) here: /EvePy/marketapp.py