These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

Looking for offline api info/documentation

Author
BonFire Circle
Sebiestor Tribe
Minmatar Republic
#1 - 2017-03-20 18:07:46 UTC  |  Edited by: BonFire Circle
I'm starting to learn python, and I'd like to learn about how to use the out-of-game API (something like what I would expect EveMon accesses). When I start to look at the documentation for stuff like this it looks pretty complicated and there's a lot of options.

So ideally I'm looking for something like a python-written out-of-game asset scraper or mail scraper or something to that effect, that I could look at in github, as well as the corresponding documentation for the out of game API. I've heard that ESI and Crest exist, but I don't know if those things are what I'm looking for.

A point in the right direction would be appreciated.
Messenger Of Truth
Butlerian Crusade
#2 - 2017-03-20 21:17:51 UTC
Imagine you wanted to print the name, gender and bio of a particular character, using the ESI API...


#!/usr/bin/env python
# -*- coding: UTF-8 -*-                                                                       
from __future__ import print_function                                                         

from bravado.client import SwaggerClient
import bravado.exception                                                                       

def main():

  client = SwaggerClient.from_url('https://esi.tech.ccp.is/latest/swagger.json')               

  characterName = "Bump Mechanic"                                                         

  charResults = client.Search.get_search(                                                     
            search=characterName,
            categories=['character'],
            strict=True,                                                                       
            ).result()['character']                                                           

  if len(charResults) <= 0: raise Exception("Character not found")                             

  characterId = charResults[0] #assuming only one result
  charInfo = client.Character.get_characters_character_id(character_id=characterId).result()   

  print("Name: %s" % (charInfo['name']))                                                       
  print("Gender: %s" % (charInfo['gender']))                                                   
  print("Bio: %s" % (charInfo['description']))                                                 


if __name__ == "__main__":                                                                     
  main()

Trade Hub Price Checker: stop.hammerti.me.uk/pricecheck

Visit "Haulers Channel" in game for all matters courier-related.

Structure name/system API: stop.hammerti.me.uk/api

Althalus Stenory
Flying Blacksmiths
#3 - 2017-03-21 07:47:58 UTC  |  Edited by: Althalus Stenory
The same thing, using EsiPy instead of bravado (which I don't like)

# -*- coding: UTF-8 -*-                                                                        

from esipy import App
from esipy import EsiClient

client = EsiClient()
app = App.create('https://esi.tech.ccp.is/latest/swagger.json')

# https://esi.tech.ccp.is/latest/#!/Search/get_search
search_op = app.op['get_search'](
    search='CCP Falcon',
    categories=['character']
)

result = client.request(search_op)

if not result.data or not result.data.character:
    print "no results"
   
else:
    # https://esi.tech.ccp.is/latest/#!/Character/get_characters_character_id
    get_char_op = app.op['get_characters_character_id'](
        character_id=result.data.character[0]
    )
    result = client.request(get_char_op )
   
    if result.data:
        print "Name: %s" % (result.data.name)                                                 
        print "Gender: %s" % (result.data.gender)                                                 
        print "Bio: %s" % (result.data.description)   


And if you need some login, for assets especially, you have a security object that will deal with auth headers etc, as long as you give him the correct information :) ( http://esipy.readthedocs.io/en/latest/auth/ for more info).

So here, instead of this basic example, you want to deal with the asset endpoint ( https://esi.tech.ccp.is/latest/#!/Assets/get_characters_character_id_assets ) using auth and then looping over everything you get :)

EsiPy - Python 2.7 / 3.3+ Swagger Client based on pyswagger for ESI

croakroach
24th Imperial Crusade
Amarr Empire
#4 - 2017-03-21 14:58:07 UTC
Just FYI. latest can change at a whim causing your app to break immediatly when updated endpoints are released.

Replace latest with v1, v2, etc, or _latest. _latest can still cause similar issues with dynamic clients such as bravado.