Fixes accept header

This commit is contained in:
Mouse Reeve 2021-12-14 13:47:09 -08:00
parent a33b5b054f
commit 09f5218f9c
1 changed files with 4 additions and 6 deletions

View File

@ -256,9 +256,7 @@ def get_data(url, params=None, timeout=10):
params=params, params=params,
headers={ # pylint: disable=line-too-long headers={ # pylint: disable=line-too-long
"Accept": ( "Accept": (
"application/activity+json," 'application/json, application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"; charset=utf-8'
' application/ld+json; profile="https://www.w3.org/ns/activitystreams",'
" application/json; charset=utf-8"
), ),
"User-Agent": settings.USER_AGENT, "User-Agent": settings.USER_AGENT,
}, },
@ -266,15 +264,15 @@ def get_data(url, params=None, timeout=10):
) )
except RequestException as err: except RequestException as err:
logger.exception(err) logger.exception(err)
raise ConnectorException() raise ConnectorException(err)
if not resp.ok: if not resp.ok:
raise ConnectorException() raise ConnectorException(resp.err)
try: try:
data = resp.json() data = resp.json()
except ValueError as err: except ValueError as err:
logger.exception(err) logger.exception(err)
raise ConnectorException() raise ConnectorException(err)
return data return data