From cf809f3b09174116c1d18345851b55fb653afa22 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 29 Jul 2021 17:16:42 +0100 Subject: [PATCH] Group webfinger --- webfinger.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/webfinger.py b/webfinger.py index 6a31c5833..e3f544a0e 100644 --- a/webfinger.py +++ b/webfinger.py @@ -63,20 +63,35 @@ def webfingerHandle(session, handle: str, httpPrefix: str, print('Webfinger from cache: ' + str(wf)) return wf url = '{}://{}/.well-known/webfinger'.format(httpPrefix, domain) - par = { - 'resource': 'acct:{}'.format(nickname + '@' + wfDomain) - } hdr = { 'Accept': 'application/jrd+json' } + par = { + 'resource': 'acct:{}'.format(nickname + '@' + wfDomain) + } + success = False try: result = \ getJson(session, url, hdr, par, debug, projectVersion, httpPrefix, fromDomain) + if result: + success = True except Exception as e: - print('ERROR: webfingerHandle ' + str(e)) - return None + print('ERROR: webfingerHandle acct ' + str(e)) + pass + if not success: + par['resource'] = par['resource'].replace('acct:', 'group:') + try: + result = \ + getJson(session, url, hdr, par, + debug, projectVersion, + httpPrefix, fromDomain) + if result: + success = True + except Exception as e: + print('ERROR: webfingerHandle group ' + str(e)) + return None if result: storeWebfingerInCache(nickname + '@' + wfDomain,