本文整理汇总了Python中stationspinner.libs.eveapihandler.EveAPIHandler.get_authed_eveapi方法的典型用法代码示例。如果您正苦于以下问题:Python EveAPIHandler.get_authed_eveapi方法的具体用法?Python EveAPIHandler.get_authed_eveapi怎么用?Python EveAPIHandler.get_authed_eveapi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stationspinner.libs.eveapihandler.EveAPIHandler
的用法示例。
在下文中一共展示了EveAPIHandler.get_authed_eveapi方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fetch_starbaselist
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_authed_eveapi [as 别名]
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)
示例2: fetch_blueprints
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_authed_eveapi [as 别名]
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)
示例3: fetch_assetlist
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_authed_eveapi [as 别名]
def fetch_assetlist(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.AssetList(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
assetlist = AssetList(owner=corporation, retrieved=api_data._meta.currentTime)
assetlist.items = handler.asset_parser(api_data.assets, Asset, corporation)
assetlist.save()
handler = CorporationAssetHandler()
handler.invalidate_entity(corporation.pk)
target.updated(api_data)
示例4: fetch_contracts
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_authed_eveapi [as 别名]
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])
示例5: fetch_membersecuritylog
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_authed_eveapi [as 别名]
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)
示例6: fetch_skill_in_training
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_authed_eveapi [as 别名]
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)
示例7: fetch_skillqueue
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_authed_eveapi [as 别名]
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)
示例8: fetch_contractbids
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_authed_eveapi [as 别名]
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)
示例9: fetch_accountbalance
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_authed_eveapi [as 别名]
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)
示例10: fetch_marketorders
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_authed_eveapi [as 别名]
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)
示例11: fetch_outpostservicedetails
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_authed_eveapi [as 别名]
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)
示例12: fetch_membermedals
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_authed_eveapi [as 别名]
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)
示例13: fetch_membertracking
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_authed_eveapi [as 别名]
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)
示例14: fetch_wallettransactions
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_authed_eveapi [as 别名]
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)
示例15: fetch_industryjobshistory
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_authed_eveapi [as 别名]
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)