Skip to content
This repository has been archived by the owner on May 21, 2023. It is now read-only.

Commit

Permalink
Convert StandingsCheck over to using evelink exclusively.
Browse files Browse the repository at this point in the history
  • Loading branch information
lizthegrey committed Aug 25, 2012
1 parent f15e89f commit e3119e8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 27 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
47 changes: 25 additions & 22 deletions StandingsCheck.py
Original file line number Diff line number Diff line change
@@ -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 = {}
Expand Down Expand Up @@ -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])

1 change: 0 additions & 1 deletion eveapi
Submodule eveapi deleted from 2aceaa
2 changes: 1 addition & 1 deletion evelink-api
Submodule evelink-api updated 65 files
+25 −24 README.md
+236 −0 bin/evelink
+33 −0 evelink/__init__.py
+43 −4 evelink/api.py
+37 −0 evelink/cache/sqlite.py
+385 −106 evelink/char.py
+23 −0 evelink/constants.py
+645 −0 evelink/corp.py
+230 −1 evelink/eve.py
+0 −3 evelink/parsing/assets.py
+26 −0 evelink/parsing/contact_list.py
+21 −0 evelink/parsing/contract_bids.py
+19 −0 evelink/parsing/contract_items.py
+38 −0 evelink/parsing/contracts.py
+80 −0 evelink/parsing/kills.py
+39 −0 evelink/parsing/wallet_journal.py
+33 −0 evelink/parsing/wallet_transactions.py
+29 −0 tests/cache/test_sqlite.py
+111 −0 tests/parsing/kills.py
+88 −0 tests/parsing/test_contact_list.py
+24 −0 tests/parsing/test_contract_bids.py
+17 −0 tests/parsing/test_contract_items.py
+61 −0 tests/parsing/test_contracts.py
+68 −0 tests/parsing/test_wallet_journal.py
+61 −0 tests/parsing/test_wallet_transactions.py
+415 −165 tests/test_char.py
+648 −1 tests/test_corp.py
+238 −0 tests/test_eve.py
+8 −0 tests/xml/char/calendar_attendees.xml
+7 −0 tests/xml/char/calendar_events.xml
+76 −0 tests/xml/char/character_sheet.xml
+17 −0 tests/xml/char/contact_list.xml
+6 −0 tests/xml/char/contact_notifications.xml
+9 −0 tests/xml/char/contract_bids.xml
+9 −0 tests/xml/char/contract_items.xml
+13 −0 tests/xml/char/faction_warfare_stats.xml
+7 −0 tests/xml/char/mailing_lists.xml
+10 −0 tests/xml/char/medals.xml
+7 −0 tests/xml/char/message_bodies.xml
+32 −0 tests/xml/char/notification_texts.xml
+7 −0 tests/xml/char/notifications.xml
+17 −0 tests/xml/char/standings.xml
+29 −0 tests/xml/char/wallet_transactions.xml
+13 −0 tests/xml/corp/contact_list.xml
+8 −0 tests/xml/corp/container_log.xml
+7 −0 tests/xml/corp/contracts.xml
+45 −0 tests/xml/corp/corporation_sheet.xml
+12 −0 tests/xml/corp/faction_warfare_stats.xml
+5 −0 tests/xml/corp/medals.xml
+5 −0 tests/xml/corp/member_medals.xml
+6 −0 tests/xml/corp/members.xml
+13 −0 tests/xml/corp/npc_standings.xml
+22 −0 tests/xml/corp/permissions.xml
+30 −0 tests/xml/corp/permissions_log.xml
+8 −0 tests/xml/corp/shareholders.xml
+22 −0 tests/xml/corp/starbase_details.xml
+5 −0 tests/xml/corp/starbases.xml
+16 −0 tests/xml/corp/station_services.xml
+14 −0 tests/xml/corp/stations.xml
+26 −0 tests/xml/corp/titles.xml
+44 −0 tests/xml/eve/certificate_tree.xml
+8 −0 tests/xml/eve/conquerable_stations.xml
+64 −0 tests/xml/eve/faction_warfare_leaderboard.xml
+10 −0 tests/xml/eve/reference_types.xml
+67 −0 tests/xml/eve/skill_tree.xml

0 comments on commit e3119e8

Please sign in to comment.