当前位置: 首页>>代码示例>>Python>>正文


Python eveapihandler.EveAPIHandler类代码示例

本文整理汇总了Python中stationspinner.libs.eveapihandler.EveAPIHandler的典型用法代码示例。如果您正苦于以下问题:Python EveAPIHandler类的具体用法?Python EveAPIHandler怎么用?Python EveAPIHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了EveAPIHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: fetch_starbaselist

def fetch_starbaselist(apiupdate_pk):
    try:
        target, corporation = _get_corporation_auth(apiupdate_pk)
    except CorporationSheet.DoesNotExist:
        log.debug("CorporationSheet for APIUpdate {0} not indexed yet.".format(apiupdate_pk))
        return
    except APIUpdate.DoesNotExist:
        log.warning("Target APIUpdate {0} was deleted mid-flight.".format(apiupdate_pk))
        return

    handler = EveAPIHandler()
    auth = handler.get_authed_eveapi(corporation.owner_key)
    try:
        api_data = auth.corp.StarbaseList(characterID=corporation.owner_key.characterID)
    except AuthenticationError:
        log.error('AuthenticationError for key "{0}" owned by "{1}"'.format(target.apikey.keyID, target.apikey.owner))
        target.delete()
        return

    posIDs = handler.autoparse_list(
        api_data.starbases,
        Starbase,
        unique_together=("itemID",),
        extra_selectors={"owner": corporation},
        owner=corporation,
        pre_save=True,
    )
    Starbase.objects.filter(owner=corporation).exclude(pk__in=posIDs).delete()
    target.updated(api_data)
开发者ID:roxlukas,项目名称:stationspinner,代码行数:29,代码来源:tasks.py

示例2: fetch_contracts

def fetch_contracts(apiupdate_pk):
    try:
        target, corporation = _get_corporation_auth(apiupdate_pk)
    except CorporationSheet.DoesNotExist:
        log.debug("CorporationSheet for APIUpdate {0} not indexed yet.".format(apiupdate_pk))
        return
    except APIUpdate.DoesNotExist:
        log.warning("Target APIUpdate {0} was deleted mid-flight.".format(apiupdate_pk))
        return

    handler = EveAPIHandler()
    auth = handler.get_authed_eveapi(target.apikey)
    try:
        api_data = auth.corp.Contracts()
    except AuthenticationError:
        log.error('AuthenticationError for key "{0}" owned by "{1}"'.format(target.apikey.keyID, target.apikey.owner))
        target.delete()
        return

    contract_ids = handler.autoparse_list(
        api_data.contractList,
        Contract,
        unique_together=("contractID",),
        extra_selectors={"owner": corporation},
        owner=corporation,
    )

    target.updated(api_data)
    corporation_contracts_updated.send(Contract, corporationID=corporation.pk)

    for id in contract_ids:
        contract = Contract.objects.get(pk=id)
        if contract.get_items().count() == 0:
            app.send_task("corporation.fetch_contractitems", [target.pk, contract.pk])
开发者ID:kriberg,项目名称:stationspinner,代码行数:34,代码来源:tasks.py

示例3: fetch_marketorders

def fetch_marketorders(apiupdate_pk):
    try:
        target, corporation = _get_corporation_auth(apiupdate_pk)
    except CorporationSheet.DoesNotExist:
        log.debug("CorporationSheet for APIUpdate {0} not indexed yet.".format(apiupdate_pk))
        return
    except APIUpdate.DoesNotExist:
        log.warning("Target APIUpdate {0} was deleted mid-flight.".format(apiupdate_pk))
        return

    handler = EveAPIHandler()
    auth = handler.get_authed_eveapi(target.apikey)
    try:
        api_data = auth.corp.MarketOrders()
    except AuthenticationError:
        log.error('AuthenticationError for key "{0}" owned by "{1}"'.format(target.apikey.keyID, target.apikey.owner))
        target.delete()
        return

    handler.autoparse_list(
        api_data.orders,
        MarketOrder,
        unique_together=("orderID",),
        extra_selectors={"owner": corporation},
        owner=corporation,
    )

    target.updated(api_data)
    corporation_market_orders_updated.send(MarketOrder, corporationID=corporation.pk)
开发者ID:kriberg,项目名称:stationspinner,代码行数:29,代码来源:tasks.py

示例4: fetch_membertracking

def fetch_membertracking(apiupdate_pk):
    try:
        target, corporation = _get_corporation_auth(apiupdate_pk)
    except CorporationSheet.DoesNotExist:
        log.debug("CorporationSheet for APIUpdate {0} not indexed yet.".format(apiupdate_pk))
        return
    except APIUpdate.DoesNotExist:
        log.warning("Target APIUpdate {0} was deleted mid-flight.".format(apiupdate_pk))
        return

    handler = EveAPIHandler()
    auth = handler.get_authed_eveapi(target.apikey)
    try:
        api_data = auth.corp.MemberTracking(characterID=target.apikey.characterID, extended=1)
    except AuthenticationError:
        log.error('AuthenticationError for key "{0}" owned by "{1}"'.format(target.apikey.keyID, target.apikey.owner))
        target.delete()
        return
    memberIDs = handler.autoparse_list(
        api_data.members,
        MemberTracking,
        unique_together=("characterID",),
        extra_selectors={"owner": corporation},
        owner=corporation,
        pre_save=True,
    )
    MemberTracking.objects.filter(owner=corporation).exclude(pk__in=memberIDs).delete()

    target.updated(api_data)
    corporation_member_tracking_updated.send(Starbase, corporationID=corporation.pk)
开发者ID:kriberg,项目名称:stationspinner,代码行数:30,代码来源:tasks.py

示例5: fetch_facilities

def fetch_facilities(apiupdate_pk):
    try:
        target, corporation = _get_corporation_auth(apiupdate_pk)
    except CorporationSheet.DoesNotExist:
        log.debug("CorporationSheet for APIUpdate {0} not indexed yet.".format(apiupdate_pk))
        return
    except APIUpdate.DoesNotExist:
        log.warning("Target APIUpdate {0} was deleted mid-flight.".format(apiupdate_pk))
        return

    handler = EveAPIHandler()
    auth = handler.get_authed_eveapi(target.apikey)
    try:
        api_data = auth.corp.Facilities()
    except AuthenticationError:
        log.error('AuthenticationError for key "{0}" owned by "{1}"'.format(target.apikey.keyID, target.apikey.owner))
        target.delete()
        return

    facility_ids = handler.autoparse_list(
        api_data.facilities,
        Facility,
        unique_together=("facilityID",),
        extra_selectors={"owner": corporation},
        owner=corporation,
    )

    Facility.objects.filter(owner=corporation).exclude(pk__in=facility_ids).delete()
    target.updated(api_data)
    corporation_facilities_updated.send(Facility, corporationID=corporation.pk)
开发者ID:kriberg,项目名称:stationspinner,代码行数:30,代码来源:tasks.py

示例6: fetch_blueprints

def fetch_blueprints(apiupdate_pk):
    try:
        target, corporation = _get_corporation_auth(apiupdate_pk)
    except CorporationSheet.DoesNotExist:
        log.debug('CorporationSheet for APIUpdate {0} not indexed yet.'.format(apiupdate_pk))
        return
    except APIUpdate.DoesNotExist:
        log.warning('Target APIUpdate {0} was deleted mid-flight.'.format(apiupdate_pk))
        return

    handler = EveAPIHandler()
    auth = handler.get_authed_eveapi(corporation.owner_key)

    try:
        api_data = auth.corp.Blueprints(characterID=corporation.owner_key.characterID)
    except AuthenticationError:
        log.error('AuthenticationError for key "{0}" owned by "{1}"'.format(
            target.apikey.keyID,
            target.apikey.owner
        ))
        target.delete()
        return

    blueprintsIDs = handler.autoparse_list(api_data.blueprints,
                          Blueprint,
                          unique_together=('itemID',),
                          extra_selectors={'owner': corporation},
                          owner=corporation,
                          pre_save=True)

    Blueprint.objects.filter(owner=corporation) \
        .exclude(pk__in=blueprintsIDs).delete()
    target.updated(api_data)
开发者ID:eve-armada,项目名称:stationspinner,代码行数:33,代码来源:tasks.py

示例7: fetch_industryjobshistory

def fetch_industryjobshistory(apiupdate_pk):
    try:
        target, character = _get_character_auth(apiupdate_pk)
    except CharacterSheet.DoesNotExist:
        log.debug('CharacterSheet for APIUpdate {0} not indexed yet.'.format(apiupdate_pk))
        return
    except APIUpdate.DoesNotExist:
        log.warning('Target APIUpdate {0} was deleted mid-flight.'.format(apiupdate_pk))
        return

    handler = EveAPIHandler()
    auth = handler.get_authed_eveapi(target.apikey)
    try:
        api_data = auth.char.IndustryJobsHistory(characterID=target.owner)
    except AuthenticationError:
        log.error('AuthenticationError for key "{0}" owned by "{1}"'.format(
            target.apikey.keyID,
            target.apikey.owner
        ))
        target.delete()
        return

    handler.autoparse_list(api_data.jobs,
                           IndustryJobHistory,
                           unique_together=('jobID',),
                           extra_selectors={'owner': character},
                           owner=character)

    target.updated(api_data)
    character_industry_jobs_history_updated.send(IndustryJobHistory, characterID=character.pk)
开发者ID:kriberg,项目名称:stationspinner,代码行数:30,代码来源:tasks.py

示例8: fetch_wallettransactions

def fetch_wallettransactions(apiupdate_pk):
    try:
        target, character = _get_character_auth(apiupdate_pk)
    except CharacterSheet.DoesNotExist:
        log.debug('CharacterSheet for APIUpdate {0} not indexed yet.'.format(apiupdate_pk))
        return
    except APIUpdate.DoesNotExist:
        log.warning('Target APIUpdate {0} was deleted mid-flight.'.format(apiupdate_pk))
        return

    handler = EveAPIHandler()
    auth = handler.get_authed_eveapi(target.apikey)
    try:
        api_data = auth.char.WalletTransactions(characterID=target.owner, rowCount=2560)
    except AuthenticationError:
        log.error('AuthenticationError for key "{0}" owned by "{1}"'.format(
            target.apikey.keyID,
            target.apikey.owner
        ))
        target.delete()
        return
    handler.autoparse_list(api_data.transactions,
                          WalletTransaction,
                          unique_together=('transactionID',),
                          extra_selectors={'owner': character},
                          owner=character,
                          exclude=['transactionType', 'transactionFor'],
                          pre_save=True)
    target.updated(api_data)
开发者ID:eve-armada,项目名称:stationspinner,代码行数:29,代码来源:tasks.py

示例9: fetch_outpostservicedetails

def fetch_outpostservicedetails(apiupdate_pk, stationID):
    try:
        target, corporation = _get_corporation_auth(apiupdate_pk)
    except CorporationSheet.DoesNotExist:
        log.debug("CorporationSheet for APIUpdate {0} not indexed yet.".format(apiupdate_pk))
        return
    except APIUpdate.DoesNotExist:
        log.warning("Target APIUpdate {0} was deleted mid-flight.".format(apiupdate_pk))
        return

    handler = EveAPIHandler()
    auth = handler.get_authed_eveapi(target.apikey)
    try:
        api_data = auth.corp.OutpostServiceDetail(itemID=stationID)
    except AuthenticationError:
        log.error('AuthenticationError for key "{0}" owned by "{1}"'.format(target.apikey.keyID, target.apikey.owner))
        target.delete()
        return

    outpost_services_ids = handler.autoparse_list(
        api_data.outpostServiceDetails,
        OutpostService,
        unique_together=("stationID", "serviceName"),
        extra_selectors={"owner": corporation},
        owner=corporation,
    )

    OutpostService.objects.filter(owner=corporation).exclude(pk__in=outpost_services_ids).delete()
    target.updated(api_data)
    corporation_outpost_services_updated.send(OutpostService, corporationID=corporation.pk, stationID=stationID)
开发者ID:kriberg,项目名称:stationspinner,代码行数:30,代码来源:tasks.py

示例10: fetch_membermedals

def fetch_membermedals(apiupdate_pk):
    try:
        target, corporation = _get_corporation_auth(apiupdate_pk)
    except CorporationSheet.DoesNotExist:
        log.debug("CorporationSheet for APIUpdate {0} not indexed yet.".format(apiupdate_pk))
        return
    except APIUpdate.DoesNotExist:
        log.warning("Target APIUpdate {0} was deleted mid-flight.".format(apiupdate_pk))
        return

    handler = EveAPIHandler()
    auth = handler.get_authed_eveapi(target.apikey)
    try:
        api_data = auth.corp.MemberMedals()
    except AuthenticationError:
        log.error('AuthenticationError for key "{0}" owned by "{1}"'.format(target.apikey.keyID, target.apikey.owner))
        target.delete()
        return

    medal_ids = handler.autoparse_list(
        api_data.issuedMedals,
        MemberMedal,
        unique_together=("medalID", "characterID"),
        extra_selectors={"owner": corporation},
        owner=corporation,
    )

    MemberMedal.objects.filter(owner=corporation).exclude(pk__in=medal_ids).delete()
    target.updated(api_data)
    corporation_member_medals_updated.send(MemberMedal, corporationID=corporation.pk)
开发者ID:kriberg,项目名称:stationspinner,代码行数:30,代码来源:tasks.py

示例11: fetch_contractbids

def fetch_contractbids(apiupdate_pk):
    try:
        target, corporation = _get_corporation_auth(apiupdate_pk)
    except CorporationSheet.DoesNotExist:
        log.debug("CorporationSheet for APIUpdate {0} not indexed yet.".format(apiupdate_pk))
        return
    except APIUpdate.DoesNotExist:
        log.warning("Target APIUpdate {0} was deleted mid-flight.".format(apiupdate_pk))
        return

    handler = EveAPIHandler()
    auth = handler.get_authed_eveapi(target.apikey)
    try:
        api_data = auth.corp.ContractBids()
    except AuthenticationError:
        log.error('AuthenticationError for key "{0}" owned by "{1}"'.format(target.apikey.keyID, target.apikey.owner))
        target.delete()
        return

    bid_ids, overlap = handler.autoparse_list(
        api_data.bidList,
        ContractBid,
        unique_together=("contractID", "bidID"),
        extra_selectors={"owner": corporation},
        owner=corporation,
        immutable=True,
    )

    target.updated(api_data)
    # Only trigger if there are new bids
    for bid in ContractBid.objects.filter(pk__in=bid_ids):
        corporation_contract_bids_new_bid.send(
            ContractBid, corporationID=corporation.pk, contractID=bid.contractID, bid_pk=bid.pk
        )
    corporation_contract_bids_updated.send(ContractBid, corporationID=corporation.pk)
开发者ID:kriberg,项目名称:stationspinner,代码行数:35,代码来源:tasks.py

示例12: fetch_skill_in_training

def fetch_skill_in_training(apiupdate_pk):
    try:
        target, character = _get_character_auth(apiupdate_pk)
    except CharacterSheet.DoesNotExist:
        log.debug('CharacterSheet for APIUpdate {0} not indexed yet.'.format(apiupdate_pk))
        return
    except APIUpdate.DoesNotExist:
        log.warning('Target APIUpdate {0} was deleted mid-flight.'.format(apiupdate_pk))
        return

    handler = EveAPIHandler()
    auth = handler.get_authed_eveapi(target.apikey)
    try:
        api_data = auth.char.SkillInTraining(characterID=target.owner)
    except AuthenticationError:
        log.error('AuthenticationError for key "{0}" owned by "{1}"'.format(
            target.apikey.keyID,
            target.apikey.owner
        ))
        target.delete()
        return
    obj = handler.autoparseObj(api_data,
                         SkillInTraining,
                         extra_selectors={'owner': character},
                         owner=character,
                         exclude=('currentTQTime',))
    obj.currentTQTime = api_data.currentTQTime.data
    obj.save()
    target.updated(api_data)
开发者ID:eve-armada,项目名称:stationspinner,代码行数:29,代码来源:tasks.py

示例13: fetch_mailinglists

def fetch_mailinglists(apiupdate_pk):
    try:
        target, character = _get_character_auth(apiupdate_pk)
    except CharacterSheet.DoesNotExist:
        log.debug('CharacterSheet for APIUpdate {0} not indexed yet.'.format(apiupdate_pk))
        return
    except APIUpdate.DoesNotExist:
        log.warning('Target APIUpdate {0} was deleted mid-flight.'.format(apiupdate_pk))
        return

    handler = EveAPIHandler()
    auth = handler.get_authed_eveapi(target.apikey)
    try:
        api_data = auth.char.MailingLists(characterID=target.owner)
    except AuthenticationError:
        log.error('AuthenticationError for key "{0}" owned by "{1}"'.format(
            target.apikey.keyID,
            target.apikey.owner
        ))
        target.delete()
        return

    listIDs = handler.autoparse_shared_list(api_data.mailingLists,
                          MailingList,
                          ('listID',),
                          character,
                          pre_save=True)

    unsubscribed = character.mailinglist_set.exclude(listID__in=listIDs)
    for desub in unsubscribed:
        desub.owners.remove(character)

    target.updated(api_data)
开发者ID:eve-armada,项目名称:stationspinner,代码行数:33,代码来源:tasks.py

示例14: fetch_skillqueue

def fetch_skillqueue(apiupdate_pk):
    try:
        target, character = _get_character_auth(apiupdate_pk)
    except CharacterSheet.DoesNotExist:
        log.debug('CharacterSheet for APIUpdate {0} not indexed yet.'.format(apiupdate_pk))
        return
    except APIUpdate.DoesNotExist:
        log.warning('Target APIUpdate {0} was deleted mid-flight.'.format(apiupdate_pk))
        return

    handler = EveAPIHandler()
    auth = handler.get_authed_eveapi(target.apikey)
    try:
        api_data = auth.char.SkillQueue(characterID=target.owner)
    except AuthenticationError:
        log.error('AuthenticationError for key "{0}" owned by "{1}"'.format(
            target.apikey.keyID,
            target.apikey.owner
        ))
        target.delete()
        return
    skills = handler.autoparse_list(api_data.skillqueue,
                                    SkillQueue,
                                    unique_together=('typeID', 'level'),
                                    extra_selectors={'owner': character},
                                    owner=character,
                                    pre_save=True)
    SkillQueue.objects.filter(owner=character).exclude(pk__in=skills).delete()
    target.updated(api_data)
开发者ID:eve-armada,项目名称:stationspinner,代码行数:29,代码来源:tasks.py

示例15: fetch_membersecuritylog

def fetch_membersecuritylog(apiupdate_pk):
    try:
        target, corporation = _get_corporation_auth(apiupdate_pk)
    except CorporationSheet.DoesNotExist:
        log.debug("CorporationSheet for APIUpdate {0} not indexed yet.".format(apiupdate_pk))
        return
    except APIUpdate.DoesNotExist:
        log.warning("Target APIUpdate {0} was deleted mid-flight.".format(apiupdate_pk))
        return

    handler = EveAPIHandler()
    auth = handler.get_authed_eveapi(target.apikey)
    try:
        api_data = auth.corp.MemberSecurityLog()
    except AuthenticationError:
        log.error('AuthenticationError for key "{0}" owned by "{1}"'.format(target.apikey.keyID, target.apikey.owner))
        target.delete()
        return

    handler.autoparse_list(
        api_data.roleHistory,
        MemberSecurityLog,
        unique_together=("changeTime", "characterID", "roleLocationType"),
        extra_selectors={"owner": corporation},
        owner=corporation,
        immutable=True,
    )

    target.updated(api_data)
    corporation_member_security_log_updated.send(MemberSecurityLog, corporationID=corporation.pk)
开发者ID:kriberg,项目名称:stationspinner,代码行数:30,代码来源:tasks.py


注:本文中的stationspinner.libs.eveapihandler.EveAPIHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。