diff options
Diffstat (limited to 'users/models')
-rw-r--r-- | users/models/identity.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/users/models/identity.py b/users/models/identity.py index 53b6f80..5056ce0 100644 --- a/users/models/identity.py +++ b/users/models/identity.py @@ -297,11 +297,14 @@ class Identity(StatorModel): if self.local: raise ValueError("Cannot fetch local identities") async with httpx.AsyncClient() as client: - response = await client.get( - self.actor_uri, - headers={"Accept": "application/json"}, - follow_redirects=True, - ) + try: + response = await client.get( + self.actor_uri, + headers={"Accept": "application/json"}, + follow_redirects=True, + ) + except (httpx.ReadTimeout, httpx.ReadError): + return False if response.status_code >= 400: return False document = canonicalise(response.json(), include_security=True) |