• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python eveapihandler.EveAPIHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: fetch_accountbalance

def fetch_accountbalance(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.AccountBalance(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
    handler.autoparse_list(api_data.accounts,
                          AccountBalance,
                          unique_together=('accountKey',),
                          extra_selectors={'owner': corporation},
                          owner=corporation,
                          pre_save=True)
    target.updated(api_data)
开发者ID:eve-armada,项目名称:stationspinner,代码行数:28,代码来源:tasks.py


示例17: fetch_mails

def fetch_mails(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.MailMessages(characterID=target.owner)
    except AuthenticationError:
        log.error('AuthenticationError for key "{0}" owned by "{1}"'.format(
            target.apikey.keyID,
            target.apikey.owner
        ))
        target.delete()
        return

    mails = handler.autoparse_shared_list(api_data.messages,
                          MailMessage,
                          ('messageID',),
                          character,
                          pre_save=True)

    unfetched_mails = MailMessage.objects.filter(
        owners__in=[character.pk],
        pk__in=mails,
        broken=False,
        raw_message=None)


    EveName.objects.populate()
    if unfetched_mails.count() > 0:
        mail_bodies = auth.char.MailBodies(characterID=target.owner,
                                               IDs=[mail.messageID for mail in unfetched_mails])

        for mail_body in mail_bodies.messages:
            try:
                mail = MailMessage.objects.get(messageID=mail_body.messageID)
                mail.raw_message = mail_body.data
                mail.populate_receivers()
                mail.save()
            except MailMessage.DoesNotExist:
                log.error('Could not fetch message body for messageID {0} belonging to character "{1}".'.format(
                    mail_body.messageID,
                    character
                ))
            #except:
            #    note.broken = True
            #    note.save()




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


示例18: fetch_notifications

def fetch_notifications(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.Notifications(characterID=target.owner)
    except AuthenticationError:
        log.error('AuthenticationError for key "{0}" owned by "{1}"'.format(
            target.apikey.keyID,
            target.apikey.owner
        ))
        target.delete()
        return

    notifications = handler.autoparse_list(api_data.notifications,
                          Notification,
                          unique_together=('notificationID',),
                          extra_selectors={'owner': character},
                          owner=character,
                          pre_save=True)

    unfetched_notifications = Notification.objects.filter(
        owner=character,
        pk__in=notifications,
        broken=False,
        raw_message=None)


    if unfetched_notifications.count() > 0:
        note_texts = auth.char.NotificationTexts(characterID=target.owner,
                                               IDs=[note.notificationID for note in unfetched_notifications])

        for note_data in note_texts.notifications:
            try:
                note = Notification.objects.get(notificationID=note_data.notificationID,
                                                owner=target.owner)
                note.raw_message = note_data.data
                note.save()
            except Notification.DoesNotExist:
                log.error('Could not fetch notification text for notificationID {0} belonging to character "{1}".'.format(
                    note_data.notificationID,
                    character
                ))
            #except:
            #    note.broken = True
            #    note.save()


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


示例19: fetch_assetlist

def fetch_assetlist(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.AssetList(characterID=target.owner)
    except AuthenticationError:
        log.error('AuthenticationError for key "{0}" owned by "{1}"'.format(
            target.apikey.keyID,
            target.apikey.owner
        ))
        target.delete()
        return


    assetlist = AssetList(owner=character,
                          retrieved=api_data._meta.currentTime)

    assetlist.items, itemIDs_with_names = handler.asset_parser(api_data.assets,
                                                               Asset,
                                                               character,
                                                               target)
    assetlist.save()
    names_registered = 0
    log.debug('Fetching the item name of {0} items.'.format(len(itemIDs_with_names)))

    for block in _blocker(itemIDs_with_names, 1000):
        try:
            if target.apikey.type == 'Account':

                api_data = auth.char.Locations(characterID=character.pk,
                                               IDs=','.join(block))
            else:
                api_data = auth.char.Locations(IDs=','.join(block))
        except Exception, ex:
            log.warning('Could not fetch names for itemIDs "{0}", with APIKey {1}.\n{2}'.format(
                block,
                target.apikey.pk,
                format_exc(ex)
            ))
            continue
        IDs = handler.autoparse_list(api_data.locations,
                               ItemLocationName,
                               unique_together=('itemID',),
                               extra_selectors={'owner': character},
                               owner=character,
                               pre_save=True)
        names_registered += len(IDs)
开发者ID:eve-armada,项目名称:stationspinner,代码行数:57,代码来源:tasks.py


示例20: fetch_conquerable_stations

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)
开发者ID:kriberg,项目名称:stationspinner,代码行数:11,代码来源:tasks.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python statistics.mean函数代码示例发布时间:2022-05-27
下一篇:
Python staticgenerator.StaticGenerator类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap