diff --git a/eve_api/api_puller/accounts.py b/eve_api/api_puller/accounts.py index 8104431..d247dcd 100755 --- a/eve_api/api_puller/accounts.py +++ b/eve_api/api_puller/accounts.py @@ -47,13 +47,19 @@ def import_eve_account(api_key, user_id): dom = minidom.parseString(account_doc.body.encode('utf-8')) - if dom.getElementsByTagName('error'): + enode = dom.getElementsByTagName('error') + print enode + if enode: try: account = EVEAccount.objects.get(id=user_id) except EVEAccount.DoesNotExist: return - account.api_status = API_STATUS_OTHER_ERROR + error = enode[0].getAttribute('code') + if error == '211': + account.api_status = API_STATUS_ACC_EXPIRED + else: + account.api_status = API_STATUS_OTHER_ERROR account.api_last_updated = datetime.utcnow() account.save() return diff --git a/eve_api/app_defines.py b/eve_api/app_defines.py index 2356d04..48e5905 100644 --- a/eve_api/app_defines.py +++ b/eve_api/app_defines.py @@ -6,12 +6,14 @@ API_STATUS_PENDING = 0 API_STATUS_OK = 1 API_STATUS_AUTH_ERROR = 2 API_STATUS_OTHER_ERROR = 3 +API_STATUS_ACC_EXPIRED = 4 # This tuple is used to assemble the choices list for the field. API_STATUS_CHOICES = ( (API_STATUS_PENDING, 'Unknown'), (API_STATUS_OK, 'OK'), (API_STATUS_AUTH_ERROR, 'Auth Error'), (API_STATUS_OTHER_ERROR, 'Other Error'), + (API_STATUS_ACC_EXPIRED, 'Account Expired'), ) API_GENDER_CHOICES = (