mirror of https://gitlab.com/bashrc2/epicyon
Group webfinger
parent
4a5a22c105
commit
cf809f3b09
25
webfinger.py
25
webfinger.py
|
@ -63,20 +63,35 @@ def webfingerHandle(session, handle: str, httpPrefix: str,
|
||||||
print('Webfinger from cache: ' + str(wf))
|
print('Webfinger from cache: ' + str(wf))
|
||||||
return wf
|
return wf
|
||||||
url = '{}://{}/.well-known/webfinger'.format(httpPrefix, domain)
|
url = '{}://{}/.well-known/webfinger'.format(httpPrefix, domain)
|
||||||
par = {
|
|
||||||
'resource': 'acct:{}'.format(nickname + '@' + wfDomain)
|
|
||||||
}
|
|
||||||
hdr = {
|
hdr = {
|
||||||
'Accept': 'application/jrd+json'
|
'Accept': 'application/jrd+json'
|
||||||
}
|
}
|
||||||
|
par = {
|
||||||
|
'resource': 'acct:{}'.format(nickname + '@' + wfDomain)
|
||||||
|
}
|
||||||
|
success = False
|
||||||
try:
|
try:
|
||||||
result = \
|
result = \
|
||||||
getJson(session, url, hdr, par,
|
getJson(session, url, hdr, par,
|
||||||
debug, projectVersion,
|
debug, projectVersion,
|
||||||
httpPrefix, fromDomain)
|
httpPrefix, fromDomain)
|
||||||
|
if result:
|
||||||
|
success = True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('ERROR: webfingerHandle ' + str(e))
|
print('ERROR: webfingerHandle acct ' + str(e))
|
||||||
return None
|
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:
|
if result:
|
||||||
storeWebfingerInCache(nickname + '@' + wfDomain,
|
storeWebfingerInCache(nickname + '@' + wfDomain,
|
||||||
|
|
Loading…
Reference in New Issue