Example #1
0
    def get(self, request):
        handler = EveAPIHandler()
        api = handler.get_eveapi()
        try:
            status = api.server.ServerStatus()
            response = json.dumps({"serverOpen": status.serverOpen,
                                   "onlinePlayers": status.onlinePlayers})

        except:
            response = '{"serverOpen": "False", "onlinePlayers": 0}'
        return HttpResponse(response)
Example #2
0
def fetch_sovereignty():
    handler = EveAPIHandler()
    api = handler.get_eveapi()
    apiData = api.map.Sovereignty()
    sovIDs = handler.autoparse_list(apiData.solarSystems,
                          Sovereignty,
                          unique_together=('solarSystemID',),
                          pre_save=True)
    log.info('Updated sovereignty for {0} systems.'.format(len(sovIDs)))
    update, created = UniverseUpdate.objects.get_or_create(apicall='Sovereignty')
    update.updated(apiData)
Example #3
0
def fetch_conquerable_stations():
    handler = EveAPIHandler()
    api = handler.get_eveapi()
    apiData = api.eve.ConquerableStationList()
    stationIDs = handler.autoparse_list(apiData.outposts,
                          ConquerableStation,
                          unique_together=('stationID',),
                          pre_save=True)
    log.info('Updated {0} conquerable stations.'.format(len(stationIDs)))
    update, created = UniverseUpdate.objects.get_or_create(apicall='ConquerableStationList')
    update.updated(apiData)
Example #4
0
def fetch_reftypes():
    handler = EveAPIHandler()
    api = handler.get_eveapi()
    apiData = api.eve.RefTypes()
    rIDs = handler.autoparse_list(apiData.refTypes,
                          RefType,
                          unique_together=('refTypeID',),
                          pre_save=True)
    log.info('Updated {0} ref types.'.format(len(rIDs)))
    update, created = UniverseUpdate.objects.get_or_create(apicall='RefTypes')
    update.updated(apiData)
Example #5
0
def fetch_apicalls():
    handler = EveAPIHandler()
    api = handler.get_eveapi()
    apiData = api.api.CallList()
    cgIDs = handler.autoparse_list(apiData.callGroups,
                          APICallGroup,
                          unique_together=('groupID',),
                          pre_save=True)
    cIDs = handler.autoparse_list(apiData.calls,
                          APICall,
                          unique_together=('accessMask', 'type'),
                          pre_save=True)

    log.info('Added {0} call groups and {1} calls.'.format(cgIDs, cIDs))
    update, created = UniverseUpdate.objects.get_or_create(apicall='CallList')
    update.updated(apiData)
Example #6
0
def fetch_alliances():
    handler = EveAPIHandler()
    api = handler.get_eveapi()
    apiData = api.eve.AllianceList()
    allianceIDs = handler.autoparse_list(apiData.alliances,
                                      Alliance,
                                      unique_together=('allianceID',))
    log.info('Updated {0} alliances.'.format(len(allianceIDs)))
    closed = Alliance.objects.exclude(pk__in=allianceIDs)
    for alliance in closed:
        alliance.closed = True
        alliance.endDate = datetime.now(tz=UTC)
        alliance.save()
    log.info('Closed {0} alliances.'.format(closed.count()))

    update, created = UniverseUpdate.objects.get_or_create(apicall='AllianceList')
    update.updated(apiData)
Example #7
0
def fetch_corporation_names():
    handler = EveAPIHandler()
    api = handler.get_eveapi()
Example #8
0
    The process is roughly:
    1. Check the key against the eveapi. Disable if expired or not existing etc
    2. Create an APIUpdate "target" for the services the access mask grants you
       access to, for every character or corporation the key is valid for.

    :param apikey_pk:
    :return:
    """
    try:
        apikey = APIKey.objects.get(pk=apikey_pk)
    except APIKey.DoesNotExist, dne:
        raise dne
    handler = EveAPIHandler()

    api = handler.get_eveapi()
    auth = api.auth(keyID=apikey.keyID, vCode=apikey.vCode)
    try:
        keyinfo = auth.account.APIKeyInfo()
    except AuthenticationError:
        apikey.brokeness += 1
        if apikey.brokeness == 3:
            apikey.expired = True
        apikey.save()
        APIUpdate.objects.filter(apikey=apikey).delete()
        log.info('APIKey "{0}" owned by "{1}" is disabled according to the eveapi.'.format(
            apikey.name,
            apikey.owner
        ))
        return
    except Exception, ex:
Example #9
0
def fetch_corporation_names():
    handler = EveAPIHandler()
    api = handler.get_eveapi()
Example #10
0
    The process is roughly:
    1. Check the key against the eveapi. Disable if expired or not existing etc
    2. Create an APIUpdate "target" for the services the access mask grants you
       access to, for every character or corporation the key is valid for.

    :param apikey_pk:
    :return:
    """
    try:
        apikey = APIKey.objects.get(pk=apikey_pk)
    except APIKey.DoesNotExist, dne:
        raise dne
    handler = EveAPIHandler()

    api = handler.get_eveapi()
    auth = api.auth(keyID=apikey.keyID, vCode=apikey.vCode)
    try:
        keyinfo = auth.account.APIKeyInfo()
    except AuthenticationError:
        apikey.brokeness += 1
        if apikey.brokeness == 3:
            apikey.expired = True
        apikey.save()
        APIUpdate.objects.filter(apikey=apikey).delete()
        log.info(
            'APIKey "{0}" owned by "{1}" is disabled according to the eveapi.'.
            format(apikey.name, apikey.owner))
        return
    except Exception, ex:
        apikey.brokeness += 1