Fixed auth=None during fetch

This commit is contained in:
Agate 2020-08-23 12:08:34 +02:00
parent 6f0bc3eb10
commit a9589fe8ac
1 changed files with 6 additions and 3 deletions

View File

@ -324,7 +324,6 @@ def fetch(fetch_obj):
auth = signing.get_auth(actor.private_key, actor.private_key_id) auth = signing.get_auth(actor.private_key, actor.private_key_id)
else: else:
auth = None auth = None
auth = None
try: try:
if url.startswith("webfinger://"): if url.startswith("webfinger://"):
# we first grab the correpsonding webfinger representation # we first grab the correpsonding webfinger representation
@ -341,10 +340,14 @@ def fetch(fetch_obj):
response = session.get_session().get( response = session.get_session().get(
auth=auth, url=url, headers={"Accept": "application/activity+json"}, auth=auth, url=url, headers={"Accept": "application/activity+json"},
) )
logger.debug("Remote answered with %s", response.status_code) logger.debug("Remote answered with %s: %s", response.status_code, response.text)
response.raise_for_status() response.raise_for_status()
except requests.exceptions.HTTPError as e: except requests.exceptions.HTTPError as e:
return error("http", status_code=e.response.status_code if e.response else None) return error(
"http",
status_code=e.response.status_code if e.response else None,
message=response.text,
)
except requests.exceptions.Timeout: except requests.exceptions.Timeout:
return error("timeout") return error("timeout")
except requests.exceptions.ConnectionError as e: except requests.exceptions.ConnectionError as e: