diff --git a/.gitmodules b/.gitmodules index 2965cd0..43cc475 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "eveapi"] - path = eveapi - url = git://github.com/lizthegrey/eveapi.git [submodule "evelink-api"] path = evelink-api url = git://github.com/eve-val/evelink.git diff --git a/StandingsCheck.py b/StandingsCheck.py index 6305af2..f594448 100755 --- a/StandingsCheck.py +++ b/StandingsCheck.py @@ -1,32 +1,33 @@ #!/usr/bin/python -from eveapi import eveapi +from evelink import api, char, corp, eve import ChatKosLookup import sys MAX_NPC_AGENT = 3020000 class StandingsChecker: - def __init__(self, keyID, vCode): + def __init__(self, keyID, vCode, char_id): self.checker = ChatKosLookup.KosChecker() - self.eveapi = self.checker.eveapi.auth(keyID=keyID, vCode=vCode) + self.cache = self.checker.cache + + self.api = api.API(cache=self.cache, api_key=(keyID, vCode)) + self.corp = corp.Corp(api=self.api) + self.eve = eve.EVE(api=self.api) + self.char = char.Char(api=self.api, char_id=char_id) def check(self): - contacts = self.eveapi.char.ContactList() + contacts = self.char.contacts() - print 'Personal' - self.check_internal(contacts.contactList) - print 'Corp' - self.check_internal(contacts.corporateContactList) - print 'Alliance' - self.check_internal(contacts.allianceContactList) + for (key, value) in contacts.items(): + print key + self.check_internal(value) def check_internal(self, contacts): - entities = [(row.contactID, row.contactName, row.standing) - for row in contacts if row.contactID > MAX_NPC_AGENT] + entities = [(row['id'], row['name'], row['standing']) + for row in contacts.values() if row['id'] > MAX_NPC_AGENT] - alive_alliances = [row.allianceID for row in - self.checker.eveapi.eve.AllianceList(version=1).alliances] + alive_alliances = self.eve.alliances().keys() remove = {} demote = {} @@ -60,21 +61,23 @@ def check_internal(self, contacts): def valid_corp(self, eid): try: - ret = self.checker.eveapi.corp.CorporationSheet(corporationID=eid) - return (ret.ceoID != 0) - except eveapi.Error: + ret = self.corp.corporation_sheet(corp_id=eid) + return (ret['ceo']['id'] != 0) + except api.APIError: return False def valid_char(self, eid): try: - self.checker.eveapi.eve.CharacterInfo(characterID=eid) + self.eve.character_info_from_id(char_id=eid) return True - except eveapi.Error: - return False + except api.APIError: + return False + except ValueError: + return False if __name__ == '__main__': - if len(sys.argv) > 2: - StandingsChecker(sys.argv[1], sys.argv[2]).check() + if len(sys.argv) > 3: + StandingsChecker(sys.argv[1], sys.argv[2], sys.argv[3]).check() else: print ('Usage: %s keyID vCode' % sys.argv[0]) diff --git a/eveapi b/eveapi deleted file mode 160000 index 2aceaaa..0000000 --- a/eveapi +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2aceaaa42848de26d68288b41ca7405d669c0e9a diff --git a/evelink-api b/evelink-api index 5a48ac7..c9378e6 160000 --- a/evelink-api +++ b/evelink-api @@ -1 +1 @@ -Subproject commit 5a48ac7961bdf41b4d0e466c329d6a9065a6ab39 +Subproject commit c9378e6981d7f1e930769ab4ba0b9d9de17a01c6