mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Return a empty list if the API key isn't available for the optimer
This commit is contained in:
@@ -36,10 +36,22 @@ class OAuthOpTimerHandler(BaseHandler):
|
|||||||
|
|
||||||
def read(self, request, id=None):
|
def read(self, request, id=None):
|
||||||
|
|
||||||
objs = [get_object_or_404(EVEAccount, pk=settings.FULL_API_USER_ID)]
|
try:
|
||||||
|
obj = EVEAccount.object.get(pk=settings.FULL_API_USER_ID)
|
||||||
|
except EVEAccount.DoesNotExist:
|
||||||
|
return {'ops':[{
|
||||||
|
'startsIn': -1,
|
||||||
|
'eventID': 0,
|
||||||
|
'ownerName': '',
|
||||||
|
'eventDate': '',
|
||||||
|
'eventTitle': '<div style="text-align:center">The Optimer API is currently unavailable.</div>',
|
||||||
|
'duration': 0,
|
||||||
|
'isImportant': 0,
|
||||||
|
'eventText': '',
|
||||||
|
'endsIn':-1,
|
||||||
|
'forumLink': ''}]}
|
||||||
|
|
||||||
events = []
|
events = []
|
||||||
for obj in objs:
|
|
||||||
params = {'keyID': obj.pk, 'vCode': obj.api_key, 'characterID': settings.FULL_API_CHARACTER_ID}
|
params = {'keyID': obj.pk, 'vCode': obj.api_key, 'characterID': settings.FULL_API_CHARACTER_ID}
|
||||||
error_doc = {'ops': [{'startsIn': -1, 'eventID': 0, 'ownerName': '', 'eventDate': '', 'eventTitle': '<div style="text-align:center">The EVE API calendar is unavailable</div>', 'duration': 0, 'isImportant': 0, 'eventText': 'Fuck CCP tbqh imho srsly', 'endsIn':-1, 'forumLink': ''}]}
|
error_doc = {'ops': [{'startsIn': -1, 'eventID': 0, 'ownerName': '', 'eventDate': '', 'eventTitle': '<div style="text-align:center">The EVE API calendar is unavailable</div>', 'duration': 0, 'isImportant': 0, 'eventText': 'Fuck CCP tbqh imho srsly', 'endsIn':-1, 'forumLink': ''}]}
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user