Skip to content

Commit

Permalink
indieauth: better error handling for invalid input URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed Apr 29, 2018
1 parent f601042 commit 1e31d6b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion oauth_dropins/indieauth.py
Expand Up @@ -15,6 +15,7 @@
import mf2py
import mf2util
import models
import requests
from webutil import util

from google.appengine.ext import ndb
Expand All @@ -34,7 +35,11 @@ def discover_authorization_endpoint(me, resp=None):
Return:
string, the discovered indieauth URL or the default indieauth.com URL
"""
resp = resp or util.requests_get(me)
try:
resp = resp or util.requests_get(me)
except requests.RequestException as e:
raise exc.HTTPBadRequest(str(e))

if resp.status_code // 100 != 2:
logging.warning(
'could not fetch user url "%s". got response code: %d',
Expand Down

0 comments on commit 1e31d6b

Please sign in to comment.