本文整理汇总了Python中stationspinner.libs.eveapihandler.EveAPIHandler.get_eveapi方法的典型用法代码示例。如果您正苦于以下问题:Python EveAPIHandler.get_eveapi方法的具体用法?Python EveAPIHandler.get_eveapi怎么用?Python EveAPIHandler.get_eveapi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stationspinner.libs.eveapihandler.EveAPIHandler
的用法示例。
在下文中一共展示了EveAPIHandler.get_eveapi方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_eveapi [as 别名]
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)
示例2: fetch_sovereignty
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_eveapi [as 别名]
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)
示例3: fetch_conquerable_stations
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_eveapi [as 别名]
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)
示例4: fetch_reftypes
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_eveapi [as 别名]
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)
示例5: fetch_apicalls
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_eveapi [as 别名]
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)
示例6: fetch_alliances
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_eveapi [as 别名]
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)
示例7: EveAPIHandler
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_eveapi [as 别名]
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:
示例8: fetch_corporation_names
# 需要导入模块: from stationspinner.libs.eveapihandler import EveAPIHandler [as 别名]
# 或者: from stationspinner.libs.eveapihandler.EveAPIHandler import get_eveapi [as 别名]
def fetch_corporation_names():
handler = EveAPIHandler()
api = handler.get_eveapi()