Files
test-auth/app/tools/management/commands/edkapiextract.py
2011-03-16 09:07:19 +00:00

23 lines
1022 B
Python

#!/usr/bin/env python2.5
from django.core.management.base import NoArgsCommand
from eve_api.models import EVEPlayerCharacter
from eve_api.app_defines import *
class Command(NoArgsCommand):
help = "Extracts a list of director's full API keys in CSV format for uploading to EDK"
def handle_noargs(self, **options):
chars = EVEPlayerCharacter.objects.filter(roles__name='roleDirector', eveaccount__api_keytype=API_KEYTYPE_FULL, eveaccount__api_status=API_STATUS_OK)
donekeys = []
i = 0
for c in chars:
i = i + 1
print "\"TEST\",\"API_CharID_%s\",\"%s\"" % (i, c.id)
print "\"TEST\",\"API_UserID_%s\",\"%s\"" % (i, c.eveaccount_set.all()[0].id)
print "\"TEST\",\"API_Key_%s\",\"%s\"" % (i, c.eveaccount_set.all()[0].api_key)
print "\"TEST\",\"API_Name_%s\",\"%s - %s\"" % (i, c.corporation.name, c.name)
print "\"TEST\",\"API_Type_%s\",\"corp\"" % (i)
print "\"TEST\",\"API_Key_count\",\"%s\"" % i