Handle errors returned from webfinger

main2
Bob Mottram 2019-10-17 15:41:47 +01:00
parent 335a35b84e
commit 13a16bec18
2 changed files with 11 additions and 1 deletions

View File

@ -883,6 +883,10 @@ if args.actor:
print('Unable to webfinger '+nickname+'@'+domain)
sys.exit()
if wfRequest.get('errors'):
print('wfRequest error: '+str(wfRequest['errors']))
sys.exit()
asHeader = {'Accept': 'application/activity+json; profile="https://www.w3.org/ns/activitystreams"'}
personUrl = getUserUrl(wfRequest)
if nickname==domain:

View File

@ -1343,6 +1343,11 @@ def sendSignedJson(postJsonObject: {},session,baseDir: str, \
print('DEBUG: webfinger for '+handle+' failed')
return 1
if wfRequest.get('errors'):
if debug:
print('DEBUG: webfinger for '+handle+' failed with errors '+str(wfRequest))
return 1
if not clientToServer:
postToBox='inbox'
else:
@ -1596,7 +1601,8 @@ def hasSharedInbox(session,httpPrefix: str,domain: str) -> bool:
wfRequest=webfingerHandle(session,domain+'@'+domain,httpPrefix,{}, \
None,__version__)
if wfRequest:
return True
if not wfRequest.get('errors'):
return True
return False
def sendToFollowers(session,baseDir: str, \