本文整理汇总了Python中services.managers.eve_api_manager.EveApiManager.get_alliance_standings方法的典型用法代码示例。如果您正苦于以下问题:Python EveApiManager.get_alliance_standings方法的具体用法?Python EveApiManager.get_alliance_standings怎么用?Python EveApiManager.get_alliance_standings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类services.managers.eve_api_manager.EveApiManager
的用法示例。
在下文中一共展示了EveApiManager.get_alliance_standings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_alliance_corp_update
# 需要导入模块: from services.managers.eve_api_manager import EveApiManager [as 别名]
# 或者: from services.managers.eve_api_manager.EveApiManager import get_alliance_standings [as 别名]
def run_alliance_corp_update():
# I am not proud of this block of code
if EveApiManager.check_if_api_server_online():
# Updated alliance info
alliance_info = EveApiManager.get_alliance_information(settings.ALLIANCE_ID)
# Populate alliance info
if not EveManager.check_if_alliance_exists_by_id(settings.ALLIANCE_ID):
EveManager.create_alliance_info(settings.ALLIANCE_ID, alliance_info['name'], alliance_info['ticker'],
alliance_info['executor_id'], alliance_info['member_count'], False)
alliance = EveManager.get_alliance_info_by_id(settings.ALLIANCE_ID)
# Create the corps in the alliance
for alliance_corp in alliance_info['member_corps']:
corpinfo = EveApiManager.get_corporation_information(alliance_corp)
if not EveManager.check_if_corporation_exists_by_id(corpinfo['id']):
EveManager.create_corporation_info(corpinfo['id'], corpinfo['name'], corpinfo['ticker'],
corpinfo['members']['current'], False, alliance)
# Create the corps in the standings
alliance_standings = EveApiManager.get_alliance_standings()
if alliance_standings:
for standing_id in EveApiManager.get_alliance_standings()['alliance']:
if int(alliance_standings['alliance'][standing_id]['standing']) >= settings.ALLIANCE_BLUE_STANDING:
if EveApiManager.check_if_id_is_character(standing_id):
pass
elif EveApiManager.check_if_id_is_corp(standing_id):
corpinfo = EveApiManager.get_corporation_information(standing_id)
if not EveManager.check_if_corporation_exists_by_id(standing_id):
EveManager.create_corporation_info(corpinfo['id'], corpinfo['name'], corpinfo['ticker'],
corpinfo['members']['current'], True, None)
else:
# Alliance id create corps
blue_alliance_info = EveApiManager.get_alliance_information(standing_id)
if not EveManager.check_if_alliance_exists_by_id(standing_id):
EveManager.create_alliance_info(standing_id, blue_alliance_info['name'],
blue_alliance_info['ticker'],
blue_alliance_info['executor_id'],
blue_alliance_info['member_count'], True)
blue_alliance = EveManager.get_alliance_info_by_id(standing_id)
for blue_alliance_corp in blue_alliance_info['member_corps']:
blue_info = EveApiManager.get_corporation_information(blue_alliance_corp)
if not EveManager.check_if_corporation_exists_by_id(blue_info['id']):
EveManager.create_corporation_info(blue_info['id'], blue_info['name'],
blue_info['ticker'],
blue_info['members']['current'], True, blue_alliance)
# Update all allinace info's
for all_alliance_info in EveManager.get_all_alliance_info():
all_alliance_api_info = EveApiManager.get_alliance_information(all_alliance_info.alliance_id)
if all_alliance_info.alliance_id == settings.ALLIANCE_ID:
EveManager.update_alliance_info(all_alliance_api_info['id'], all_alliance_api_info['executor_id'],
all_alliance_api_info['member_count'], False)
else:
if 'alliance' in alliance_standings:
if int(all_alliance_info.alliance_id) in alliance_standings['alliance']:
if int(alliance_standings['alliance'][int(all_alliance_info.alliance_id)][
'standing']) >= settings.ALLIANCE_BLUE_STANDING:
EveManager.update_alliance_info(all_alliance_api_info['id'],
all_alliance_api_info['executor_id'],
all_alliance_api_info['member_count'], True)
else:
EveManager.update_alliance_info(all_alliance_api_info['id'],
all_alliance_api_info['executor_id'],
all_alliance_api_info['member_count'], False)
else:
EveManager.update_alliance_info(all_alliance_api_info['id'],
all_alliance_api_info['executor_id'],
all_alliance_api_info['member_count'], False)
else:
EveManager.update_alliance_info(all_alliance_api_info['id'],
all_alliance_api_info['executor_id'],
all_alliance_api_info['member_count'], False)
# Update corp infos
for all_corp_info in EveManager.get_all_corporation_info():
alliance = None
corpinfo = EveApiManager.get_corporation_information(all_corp_info.corporation_id)
if corpinfo['alliance']['id'] is not None:
alliance = EveManager.get_alliance_info_by_id(corpinfo['alliance']['id'])
if alliance is not None and all_corp_info.alliance is not None:
if all_corp_info.alliance.alliance_id == settings.ALLIANCE_ID:
EveManager.update_corporation_info(corpinfo['id'], corpinfo['members']['current'], alliance, False)
else:
if int(alliance.alliance_id) in alliance_standings['alliance']:
if int(alliance_standings['alliance'][int(alliance.alliance_id)][
'standing']) >= settings.ALLIANCE_BLUE_STANDING:
EveManager.update_corporation_info(corpinfo['id'], corpinfo['members']['current'], alliance,
True)
else:
EveManager.update_corporation_info(corpinfo['id'], corpinfo['members']['current'], alliance,
False)
#.........这里部分代码省略.........