forked from 00dani/lemoncurry
Gracefully handle failure to fetch h-x-app
This commit is contained in:
parent
03956637be
commit
8386f77d72
1 changed files with 3 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
from requests import HTTPError
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.views.generic import TemplateView
|
from django.views.generic import TemplateView
|
||||||
from typing import Dict, Optional, Set
|
from typing import Dict, Optional, Set
|
||||||
|
@ -20,10 +21,10 @@ class Client:
|
||||||
self.id = client_id
|
self.id = client_id
|
||||||
self.count = 0
|
self.count = 0
|
||||||
self.scopes = set()
|
self.scopes = set()
|
||||||
apps = mf2(self.id).to_dict(filter_by_type="h-x-app")
|
|
||||||
try:
|
try:
|
||||||
|
apps = mf2(self.id).to_dict(filter_by_type="h-x-app")
|
||||||
self.app = apps[0]["properties"]
|
self.app = apps[0]["properties"]
|
||||||
except IndexError:
|
except (HTTPError, IndexError):
|
||||||
self.app = None
|
self.app = None
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue