mirror of https://gitlab.com/bashrc2/epicyon
Debug
parent
7c76ff7e21
commit
eec6e0c049
17
posts.py
17
posts.py
|
@ -222,7 +222,7 @@ def getUserUrl(wfRequest: {}, sourceId: int = 0, debug: bool = False) -> str:
|
||||||
def parseUserFeed(signingPrivateKeyPem: str,
|
def parseUserFeed(signingPrivateKeyPem: str,
|
||||||
session, feedUrl: str, asHeader: {},
|
session, feedUrl: str, asHeader: {},
|
||||||
projectVersion: str, httpPrefix: str,
|
projectVersion: str, httpPrefix: str,
|
||||||
domain: str, debug: bool, depth: int = 0) -> []:
|
originDomain: str, debug: bool, depth: int = 0) -> []:
|
||||||
if depth > 10:
|
if depth > 10:
|
||||||
if debug:
|
if debug:
|
||||||
print('Maximum search depth reached')
|
print('Maximum search depth reached')
|
||||||
|
@ -232,9 +232,10 @@ def parseUserFeed(signingPrivateKeyPem: str,
|
||||||
print('Getting user feed for ' + feedUrl)
|
print('Getting user feed for ' + feedUrl)
|
||||||
print('User feed header ' + str(asHeader))
|
print('User feed header ' + str(asHeader))
|
||||||
print('httpPrefix ' + str(httpPrefix))
|
print('httpPrefix ' + str(httpPrefix))
|
||||||
|
print('originDomain ' + str(originDomain))
|
||||||
|
|
||||||
feedJson = getJson(signingPrivateKeyPem, session, feedUrl, asHeader, None,
|
feedJson = getJson(signingPrivateKeyPem, session, feedUrl, asHeader, None,
|
||||||
debug, projectVersion, httpPrefix, domain)
|
debug, projectVersion, httpPrefix, originDomain)
|
||||||
if not feedJson:
|
if not feedJson:
|
||||||
profileStr = 'https://www.w3.org/ns/activitystreams'
|
profileStr = 'https://www.w3.org/ns/activitystreams'
|
||||||
acceptStr = 'application/ld+json; profile="' + profileStr + '"'
|
acceptStr = 'application/ld+json; profile="' + profileStr + '"'
|
||||||
|
@ -244,7 +245,7 @@ def parseUserFeed(signingPrivateKeyPem: str,
|
||||||
}
|
}
|
||||||
feedJson = getJson(signingPrivateKeyPem, session, feedUrl,
|
feedJson = getJson(signingPrivateKeyPem, session, feedUrl,
|
||||||
asHeader, None, debug, projectVersion,
|
asHeader, None, debug, projectVersion,
|
||||||
httpPrefix, domain)
|
httpPrefix, originDomain)
|
||||||
if not feedJson:
|
if not feedJson:
|
||||||
if debug:
|
if debug:
|
||||||
print('No user feed was returned')
|
print('No user feed was returned')
|
||||||
|
@ -275,7 +276,7 @@ def parseUserFeed(signingPrivateKeyPem: str,
|
||||||
parseUserFeed(signingPrivateKeyPem,
|
parseUserFeed(signingPrivateKeyPem,
|
||||||
session, nextUrl, asHeader,
|
session, nextUrl, asHeader,
|
||||||
projectVersion, httpPrefix,
|
projectVersion, httpPrefix,
|
||||||
domain, debug, depth + 1)
|
originDomain, debug, depth + 1)
|
||||||
if userFeed:
|
if userFeed:
|
||||||
return userFeed
|
return userFeed
|
||||||
elif isinstance(nextUrl, dict):
|
elif isinstance(nextUrl, dict):
|
||||||
|
@ -498,7 +499,7 @@ def _getPosts(session, outboxUrl: str, maxPosts: int,
|
||||||
personCache: {}, raw: bool,
|
personCache: {}, raw: bool,
|
||||||
simple: bool, debug: bool,
|
simple: bool, debug: bool,
|
||||||
projectVersion: str, httpPrefix: str,
|
projectVersion: str, httpPrefix: str,
|
||||||
domain: str, systemLanguage: str,
|
originDomain: str, systemLanguage: str,
|
||||||
signingPrivateKeyPem: str) -> {}:
|
signingPrivateKeyPem: str) -> {}:
|
||||||
"""Gets public posts from an outbox
|
"""Gets public posts from an outbox
|
||||||
"""
|
"""
|
||||||
|
@ -528,7 +529,8 @@ def _getPosts(session, outboxUrl: str, maxPosts: int,
|
||||||
i = 0
|
i = 0
|
||||||
userFeed = parseUserFeed(signingPrivateKeyPem,
|
userFeed = parseUserFeed(signingPrivateKeyPem,
|
||||||
session, outboxUrl, asHeader,
|
session, outboxUrl, asHeader,
|
||||||
projectVersion, httpPrefix, domain, debug)
|
projectVersion, httpPrefix,
|
||||||
|
originDomain, debug)
|
||||||
for item in userFeed:
|
for item in userFeed:
|
||||||
result.append(item)
|
result.append(item)
|
||||||
i += 1
|
i += 1
|
||||||
|
@ -541,7 +543,8 @@ def _getPosts(session, outboxUrl: str, maxPosts: int,
|
||||||
print('Returning a human readable version of the feed')
|
print('Returning a human readable version of the feed')
|
||||||
userFeed = parseUserFeed(signingPrivateKeyPem,
|
userFeed = parseUserFeed(signingPrivateKeyPem,
|
||||||
session, outboxUrl, asHeader,
|
session, outboxUrl, asHeader,
|
||||||
projectVersion, httpPrefix, domain, debug)
|
projectVersion, httpPrefix,
|
||||||
|
originDomain, debug)
|
||||||
if not userFeed:
|
if not userFeed:
|
||||||
return personPosts
|
return personPosts
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue