fix logging for failed outbound HTTP requests

also disable logging full parsed mf2 in activitypub actor handler.
pull/27/head
Ryan Barrett 2017-10-24 07:23:51 -07:00
rodzic 786173d270
commit a1a66c2f24
2 zmienionych plików z 4 dodań i 3 usunięć

Wyświetl plik

@ -32,7 +32,7 @@ class ActorHandler(webapp2.RequestHandler):
url = 'http://%s/' % domain
resp = common.requests_get(url)
mf2 = mf2py.parse(resp.text, url=resp.url)
logging.info('Parsed mf2 for %s: %s', resp.url, json.dumps(mf2, indent=2))
# logging.info('Parsed mf2 for %s: %s', resp.url, json.dumps(mf2, indent=2))
hcard = mf2util.representative_hcard(mf2, resp.url)
logging.info('Representative h-card: %s', json.dumps(hcard, indent=2))

Wyświetl plik

@ -81,8 +81,9 @@ def _requests_fn(fn, url, parse_json=False, **kwargs):
logging.info(resp.text)
if resp.status_code // 100 in (4, 5):
raise exc.HTTPBadGateway('Received %s from %s:\n%s' %
(resp.status_code, url, resp.text))
msg = 'Received %s from %s:\n%s' % (resp.status_code, url, resp.text)
logging.info(msg)
raise exc.HTTPBadGateway(msg)
if parse_json:
try: