eve-val/evelink

Corporate API Key usage

markhamilton1 opened this issue · 3 comments

I did not know how else to ask this question. Can someone send me an example of using a corporate api_key to get corporate info? Thanks! If there is a better way for me to ask questions like this please let me know.

There really isn't any real distinction between user API key and corporate API key from the end-user side of things, it's only a matter whether the given key has access to the data being requested. If you looked at the code first, you can find that there is a whole module dealing with corporation stuff, which you can use. Actual usage is no different:

from evelink import api
from evelink import corp

api = api.API(api_key=(id_, vcode))
corp = corp.Corp(api)
starbases = corp.starbases()
ayust commented

Yep, as already mentioned - just create an API object with a corp api key; then create a Corp object passing that API object in, and then call a method on it.

ayust commented

Here's an example that checks to make sure all of a corp's owned stations have the "Use Alliance Standings" option set:

import evelink
api_obj = evelink.api.API(api_key=(12345678, "vcodegoeshere"))
corp = evelink.corp.Corp(api=api_obj)
corp_info = corp.corporation_sheet().result
for station in corp.stations().result.values():
    if station["standing_owner_id"] != corp_info["alliance"]["id"]:
        print(station["name"], "isn't using alliance standings!")