From 37aaaa97b20eff2cf97696b612d8a0d80cc7568b Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 12 Dec 2020 15:33:07 -0800 Subject: [PATCH] Catch http erros for remote_id --- bookwyrm/outgoing.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bookwyrm/outgoing.py b/bookwyrm/outgoing.py index 2f94d2c0..38b48282 100644 --- a/bookwyrm/outgoing.py +++ b/bookwyrm/outgoing.py @@ -4,10 +4,11 @@ import re from django.db import IntegrityError, transaction from django.http import HttpResponseNotFound, JsonResponse from django.views.decorators.csrf import csrf_exempt +from requests import HTTPError from bookwyrm import activitypub from bookwyrm import models -from bookwyrm.connectors import get_data +from bookwyrm.connectors import get_data, ConnectorException from bookwyrm.broadcast import broadcast from bookwyrm.status import create_notification from bookwyrm.status import create_generated_note @@ -52,7 +53,11 @@ def handle_remote_webfinger(query): except models.User.DoesNotExist: url = 'https://%s/.well-known/webfinger?resource=acct:%s' % \ (domain, query) - data = get_data(url) + try: + data = get_data(url) + except (ConnectorException, HTTPError): + return None + for link in data.get('links'): if link.get('rel') == 'self': try: