1
0
Fork 0

Trying to get federated posting to work

This commit is contained in:
Mouse Reeve 2020-02-15 11:13:49 -08:00
parent e0e419a757
commit 818e5bd0fa
9 changed files with 115 additions and 86 deletions

View file

@ -8,8 +8,6 @@ import json
import requests
from urllib.parse import urlparse
from fedireads import incoming
def get_recipients(user, post_privacy, direct_recipients=None):
''' deduplicated list of recipient inboxes '''
@ -40,7 +38,7 @@ def broadcast(sender, activity, recipients):
errors = []
for recipient in recipients:
try:
sign_and_send(sender, activity, recipient)
response = sign_and_send(sender, activity, recipient)
except requests.exceptions.HTTPError as e:
# TODO: maybe keep track of users who cause errors
errors.append({
@ -85,5 +83,5 @@ def sign_and_send(sender, activity, destination):
)
if not response.ok:
response.raise_for_status()
incoming.handle_response(response)
return response