Token expired exception
This commit is contained in:
parent
da80ab7d7e
commit
97b4dac813
1 changed files with 8 additions and 1 deletions
|
@ -10,6 +10,7 @@ from django.dispatch import receiver
|
|||
from django.core.mail import send_mail
|
||||
|
||||
from wagtail.contrib.settings.models import BaseSetting, register_setting
|
||||
from wagtail.wagtailadmin import messages
|
||||
|
||||
from .models import Entry, Stream
|
||||
import feedler.feedparser as feedparser
|
||||
|
@ -52,7 +53,13 @@ def handle_save_settings(sender, instance, *args, **kwargs):
|
|||
}
|
||||
contents = requests.get(url, headers=headers).json()
|
||||
if 'errorMessage' in contents:
|
||||
raise PermissionError(contents['errorMessage'])
|
||||
# Usually this is a token expired
|
||||
if 'token expired' in contents['errorMessage']:
|
||||
# TODO: request new token
|
||||
pass
|
||||
logger.error(contents['errorMessage'])
|
||||
messages.error(sender, "Failed to fetch items: %s" % contents['errorMessage'])
|
||||
return
|
||||
for raw_entry in contents['items']:
|
||||
eid = raw_entry['id']
|
||||
# Create or update data
|
||||
|
|
Loading…
Reference in a new issue