本文整理匯總了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()