diff options
author | raylu <raylu@gridium.com> | 2013-10-24 23:03:37 -0700 |
---|---|---|
committer | raylu <raylu@gridium.com> | 2013-10-24 23:03:37 -0700 |
commit | 0187a3f26bb44c1cfcdeb5dbdd2185db8e4ba48b (patch) | |
tree | defdb4417c44da534c86f19ef0ea6a849a9b56c1 /importer.py | |
parent | db638604859d990437a0616936773604446c22f5 (diff) | |
download | ykill-0187a3f26bb44c1cfcdeb5dbdd2185db8e4ba48b.tar.xz |
import kills by kill_id in dev
by querying live for character_id
Diffstat (limited to 'importer.py')
-rwxr-xr-x | importer.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/importer.py b/importer.py index 65ac211..8e25e0f 100755 --- a/importer.py +++ b/importer.py @@ -71,6 +71,21 @@ def insert_kill(c, kill): def main(): rs = requests.session() with db.cursor() as c: + if len(sys.argv) == 2: + kill_id = sys.argv[1] + response = rs.get('http://api.whelp.gg/kill/' + kill_id) + character_id = response.json()['victim']['character_id'] + url = 'https://zkillboard.com/api/losses/characterID/{}/beforeKillID/{}/limit/1' + response = rs.get(url.format(character_id, int(kill_id) + 1)) + data = response.json() + if len(data) != 1: + raise Exception('got {} kills'.format(len(data))) + if insert_kill(c, data[0]): + print('inserted!') + else: + print('duplicate') + return + groups = db.query(c, 'SELECT groupID FROM eve.invGroups WHERE categoryID = ?', 6) groups = list(map(operator.itemgetter('groupID'), groups)) last_kill_ids = {} |