mirror of https://gitlab.com/bashrc2/epicyon
Try alternative webfinger resource
parent
d559d59abe
commit
d6864e9ee3
20
webfinger.py
20
webfinger.py
|
@ -100,6 +100,26 @@ def webfinger_handle(session, handle: str, http_prefix: str,
|
||||||
print('ERROR: webfinger_handle ' + wf_handle + ' ' + str(ex))
|
print('ERROR: webfinger_handle ' + wf_handle + ' ' + str(ex))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
# if the first attempt fails then try specifying the webfinger
|
||||||
|
# resource in a different way
|
||||||
|
if not result:
|
||||||
|
resource = handle
|
||||||
|
if handle == wf_handle:
|
||||||
|
# reconstruct the actor
|
||||||
|
resource = http_prefix + '://' + wf_domain + '/users/' + nickname
|
||||||
|
# try again using the actor as the resource
|
||||||
|
# See https://datatracker.ietf.org/doc/html/rfc7033 section 4.5
|
||||||
|
par = {
|
||||||
|
'resource': '{}'.format(resource)
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
result = \
|
||||||
|
get_json(signing_priv_key_pem, session, url, hdr, par,
|
||||||
|
debug, project_version, http_prefix, from_domain)
|
||||||
|
except Exception as ex:
|
||||||
|
print('ERROR: webfinger_handle ' + wf_handle + ' ' + str(ex))
|
||||||
|
return None
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
store_webfinger_in_cache(wf_handle, result, cached_webfingers)
|
store_webfinger_in_cache(wf_handle, result, cached_webfingers)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue