main
Bob Mottram 2021-06-02 20:38:12 +01:00
parent d4a6a2437b
commit 0f81cc6ef8
2 changed files with 17 additions and 26 deletions

View File

@ -1309,9 +1309,9 @@ def getActorJson(handle: str, http: bool, gnunet: bool,
return None
profileStr = 'https://www.w3.org/ns/activitystreams'
asHeader = {
'Accept': 'application/activity+json; profile="' + profileStr + '"'
}
headersList = (
"activity+json", "ld+json", "jrd+json"
)
if not personUrl:
personUrl = getUserUrl(wfRequest, 0, debug)
if nickname == domain:
@ -1323,32 +1323,24 @@ def getActorJson(handle: str, http: bool, gnunet: bool,
if not personUrl:
# try single user instance
personUrl = httpPrefix + '://' + domain
asHeader = {
'Accept': 'application/ld+json; profile="' + profileStr + '"'
}
headersList = (
"ld+json", "jrd+json", "activity+json"
)
if '/channel/' in personUrl or '/accounts/' in personUrl:
asHeader = {
'Accept': 'application/ld+json; profile="' + profileStr + '"'
}
headersList = (
"ld+json", "jrd+json", "activity+json"
)
personJson = \
getJson(session, personUrl, asHeader, None,
debug, __version__, httpPrefix, None, 20, quiet)
if personJson:
if not quiet:
pprint(personJson)
return personJson
else:
for headerType in headersList:
headerMimeType = 'application/' + headerType
asHeader = {
'Accept': 'application/jrd+json; profile="' + profileStr + '"'
'Accept': headerMimeType + '; profile="' + profileStr + '"'
}
personJson = \
getJson(session, personUrl, asHeader, None,
debug, __version__, httpPrefix, None)
if not quiet:
if personJson:
print('getActorJson returned actor')
debug, __version__, httpPrefix, None, 20, quiet)
if personJson:
if not quiet:
pprint(personJson)
else:
print('Failed to get ' + personUrl)
return personJson
return personJson
return None

View File

@ -15,7 +15,6 @@ import json
import idna
import locale
from pprint import pprint
from calendar import monthrange
from followingCalendar import addPersonToCalendar
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes