Improve c2s debug messages

main
Bob Mottram 2021-03-18 10:01:01 +00:00
parent d3a42f862d
commit 4804070fd1
9 changed files with 97 additions and 86 deletions

View File

@ -225,8 +225,8 @@ def sendAnnounceViaServer(baseDir: str, session,
print('DEBUG: announce webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
print('WARN: Webfinger for ' + handle + ' did not return a dict. ' +
str(wfRequest))
print('WARN: announce webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
return 1
postToBox = 'outbox'
@ -242,11 +242,12 @@ def sendAnnounceViaServer(baseDir: str, session,
if not inboxUrl:
if debug:
print('DEBUG: No ' + postToBox + ' was found for ' + handle)
print('DEBUG: announce no ' + postToBox +
' was found for ' + handle)
return 3
if not fromPersonId:
if debug:
print('DEBUG: No actor was found for ' + handle)
print('DEBUG: announce no actor was found for ' + handle)
return 4
authHeader = createBasicAuthHeader(fromNickname, password)
@ -259,7 +260,7 @@ def sendAnnounceViaServer(baseDir: str, session,
postResult = postJson(session, newAnnounceJson, [], inboxUrl,
headers, 30, True)
if not postResult:
print('WARN: Announce not posted')
print('WARN: announce not posted')
if debug:
print('DEBUG: c2s POST announce success')

View File

@ -108,11 +108,11 @@ def sendAvailabilityViaServer(baseDir: str, session,
domain, projectVersion, debug)
if not wfRequest:
if debug:
print('DEBUG: announce webfinger failed for ' + handle)
print('DEBUG: availability webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
print('WARN: Webfinger for ' + handle + ' did not return a dict. ' +
str(wfRequest))
print('WARN: availability webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
return 1
postToBox = 'outbox'
@ -127,11 +127,12 @@ def sendAvailabilityViaServer(baseDir: str, session,
if not inboxUrl:
if debug:
print('DEBUG: No ' + postToBox + ' was found for ' + handle)
print('DEBUG: availability no ' + postToBox +
' was found for ' + handle)
return 3
if not fromPersonId:
if debug:
print('DEBUG: No actor was found for ' + handle)
print('DEBUG: availability no actor was found for ' + handle)
return 4
authHeader = createBasicAuthHeader(nickname, password)
@ -144,7 +145,7 @@ def sendAvailabilityViaServer(baseDir: str, session,
postResult = postJson(session, newAvailabilityJson, [],
inboxUrl, headers, 30, True)
if not postResult:
print('WARN: failed to post availability')
print('WARN: availability failed to post')
if debug:
print('DEBUG: c2s POST availability success')

View File

@ -58,11 +58,11 @@ def sendDeleteViaServer(baseDir: str, session,
fromDomain, projectVersion, debug)
if not wfRequest:
if debug:
print('DEBUG: announce webfinger failed for ' + handle)
print('DEBUG: delete webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
print('WARN: Webfinger for ' + handle + ' did not return a dict. ' +
str(wfRequest))
print('WARN: delete webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
return 1
postToBox = 'outbox'
@ -76,11 +76,12 @@ def sendDeleteViaServer(baseDir: str, session,
if not inboxUrl:
if debug:
print('DEBUG: No ' + postToBox + ' was found for ' + handle)
print('DEBUG: delete no ' + postToBox +
' was found for ' + handle)
return 3
if not fromPersonId:
if debug:
print('DEBUG: No actor was found for ' + handle)
print('DEBUG: delete no actor was found for ' + handle)
return 4
authHeader = createBasicAuthHeader(fromNickname, password)
@ -94,7 +95,7 @@ def sendDeleteViaServer(baseDir: str, session,
postJson(session, newDeleteJson, [], inboxUrl, headers, 30, True)
if not postResult:
if debug:
print('DEBUG: POST announce failed for c2s to ' + inboxUrl)
print('DEBUG: POST delete failed for c2s to ' + inboxUrl)
return 5
if debug:

View File

@ -992,11 +992,11 @@ def sendFollowRequestViaServer(baseDir: str, session,
fromDomain, projectVersion, debug)
if not wfRequest:
if debug:
print('DEBUG: announce webfinger failed for ' + handle)
print('DEBUG: follow request webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
print('WARN: Webfinger for ' + handle + ' did not return a dict. ' +
str(wfRequest))
print('WARN: follow request Webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
return 1
postToBox = 'outbox'
@ -1010,11 +1010,12 @@ def sendFollowRequestViaServer(baseDir: str, session,
if not inboxUrl:
if debug:
print('DEBUG: No ' + postToBox + ' was found for ' + handle)
print('DEBUG: follow request no ' + postToBox +
' was found for ' + handle)
return 3
if not fromPersonId:
if debug:
print('DEBUG: No actor was found for ' + handle)
print('DEBUG: follow request no actor was found for ' + handle)
return 4
authHeader = createBasicAuthHeader(fromNickname, password)
@ -1028,11 +1029,11 @@ def sendFollowRequestViaServer(baseDir: str, session,
postJson(session, newFollowJson, [], inboxUrl, headers, 30, True)
if not postResult:
if debug:
print('DEBUG: POST follow failed for c2s to ' + inboxUrl)
print('DEBUG: POST follow request failed for c2s to ' + inboxUrl)
return 5
if debug:
print('DEBUG: c2s POST follow success')
print('DEBUG: c2s POST follow request success')
return newFollowJson
@ -1081,11 +1082,11 @@ def sendUnfollowRequestViaServer(baseDir: str, session,
fromDomain, projectVersion, debug)
if not wfRequest:
if debug:
print('DEBUG: announce webfinger failed for ' + handle)
print('DEBUG: unfollow webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
print('WARN: Webfinger for ' + handle + ' did not return a dict. ' +
str(wfRequest))
print('WARN: unfollow webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
return 1
postToBox = 'outbox'
@ -1102,11 +1103,12 @@ def sendUnfollowRequestViaServer(baseDir: str, session,
if not inboxUrl:
if debug:
print('DEBUG: No ' + postToBox + ' was found for ' + handle)
print('DEBUG: unfollow no ' + postToBox +
' was found for ' + handle)
return 3
if not fromPersonId:
if debug:
print('DEBUG: No actor was found for ' + handle)
print('DEBUG: unfollow no actor was found for ' + handle)
return 4
authHeader = createBasicAuthHeader(fromNickname, password)
@ -1120,7 +1122,7 @@ def sendUnfollowRequestViaServer(baseDir: str, session,
postJson(session, unfollowJson, [], inboxUrl, headers, 30, True)
if not postResult:
if debug:
print('DEBUG: POST announce failed for c2s to ' + inboxUrl)
print('DEBUG: POST unfollow failed for c2s to ' + inboxUrl)
return 5
if debug:

24
like.py
View File

@ -170,11 +170,11 @@ def sendLikeViaServer(baseDir: str, session,
fromDomain, projectVersion, debug)
if not wfRequest:
if debug:
print('DEBUG: announce webfinger failed for ' + handle)
print('DEBUG: like webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
print('WARN: Webfinger for ' + handle + ' did not return a dict. ' +
str(wfRequest))
print('WARN: like webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
return 1
postToBox = 'outbox'
@ -189,11 +189,11 @@ def sendLikeViaServer(baseDir: str, session,
if not inboxUrl:
if debug:
print('DEBUG: No ' + postToBox + ' was found for ' + handle)
print('DEBUG: like no ' + postToBox + ' was found for ' + handle)
return 3
if not fromPersonId:
if debug:
print('DEBUG: No actor was found for ' + handle)
print('DEBUG: like no actor was found for ' + handle)
return 4
authHeader = createBasicAuthHeader(fromNickname, password)
@ -207,7 +207,7 @@ def sendLikeViaServer(baseDir: str, session,
headers, 30, True)
if not postResult:
if debug:
print('WARN: POST announce failed for c2s to ' + inboxUrl)
print('WARN: POST like failed for c2s to ' + inboxUrl)
return 5
if debug:
@ -251,11 +251,11 @@ def sendUndoLikeViaServer(baseDir: str, session,
fromDomain, projectVersion, debug)
if not wfRequest:
if debug:
print('DEBUG: announce webfinger failed for ' + handle)
print('DEBUG: unlike webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
if debug:
print('WARN: Webfinger for ' + handle +
print('WARN: unlike webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
return 1
@ -271,11 +271,11 @@ def sendUndoLikeViaServer(baseDir: str, session,
if not inboxUrl:
if debug:
print('DEBUG: No ' + postToBox + ' was found for ' + handle)
print('DEBUG: unlike no ' + postToBox + ' was found for ' + handle)
return 3
if not fromPersonId:
if debug:
print('DEBUG: No actor was found for ' + handle)
print('DEBUG: unlike no actor was found for ' + handle)
return 4
authHeader = createBasicAuthHeader(fromNickname, password)
@ -289,11 +289,11 @@ def sendUndoLikeViaServer(baseDir: str, session,
headers, 30, True)
if not postResult:
if debug:
print('WARN: POST announce failed for c2s to ' + inboxUrl)
print('WARN: POST unlike failed for c2s to ' + inboxUrl)
return 5
if debug:
print('DEBUG: c2s POST undo like success')
print('DEBUG: c2s POST unlike success')
return newUndoLikeJson

View File

@ -2056,11 +2056,11 @@ def sendPostViaServer(projectVersion: str,
fromDomain, projectVersion, debug)
if not wfRequest:
if debug:
print('DEBUG: webfinger failed for ' + handle)
print('DEBUG: post webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
print('WARN: Webfinger for ' + handle + ' did not return a dict. ' +
str(wfRequest))
print('WARN: post webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
return 1
postToBox = 'outbox'
@ -2078,11 +2078,12 @@ def sendPostViaServer(projectVersion: str,
82796)
if not inboxUrl:
if debug:
print('DEBUG: No ' + postToBox + ' was found for ' + handle)
print('DEBUG: post no ' + postToBox +
' was found for ' + handle)
return 3
if not fromPersonId:
if debug:
print('DEBUG: No actor was found for ' + handle)
print('DEBUG: post no actor was found for ' + handle)
return 4
# Get the json for the c2s post, not saving anything to file
@ -2131,7 +2132,7 @@ def sendPostViaServer(projectVersion: str,
inboxUrl, headers)
if not postResult:
if debug:
print('DEBUG: Failed to upload image')
print('DEBUG: post failed to upload image')
# return 9
headers = {
@ -4156,11 +4157,11 @@ def sendBlockViaServer(baseDir: str, session,
fromDomain, projectVersion, debug)
if not wfRequest:
if debug:
print('DEBUG: announce webfinger failed for ' + handle)
print('DEBUG: block webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
print('WARN: Webfinger for ' + handle + ' did not return a dict. ' +
str(wfRequest))
print('WARN: block Webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
return 1
postToBox = 'outbox'
@ -4175,11 +4176,11 @@ def sendBlockViaServer(baseDir: str, session,
if not inboxUrl:
if debug:
print('DEBUG: No ' + postToBox + ' was found for ' + handle)
print('DEBUG: block no ' + postToBox + ' was found for ' + handle)
return 3
if not fromPersonId:
if debug:
print('DEBUG: No actor was found for ' + handle)
print('DEBUG: block no actor was found for ' + handle)
return 4
authHeader = createBasicAuthHeader(fromNickname, password)
@ -4192,7 +4193,7 @@ def sendBlockViaServer(baseDir: str, session,
postResult = postJson(session, newBlockJson, [], inboxUrl,
headers, 30, True)
if not postResult:
print('WARN: Unable to post block')
print('WARN: block unable to post')
if debug:
print('DEBUG: c2s POST block success')
@ -4240,11 +4241,11 @@ def sendUndoBlockViaServer(baseDir: str, session,
fromDomain, projectVersion, debug)
if not wfRequest:
if debug:
print('DEBUG: announce webfinger failed for ' + handle)
print('DEBUG: unblock webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
print('WARN: Webfinger for ' + handle + ' did not return a dict. ' +
str(wfRequest))
print('WARN: unblock webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
return 1
postToBox = 'outbox'
@ -4258,11 +4259,12 @@ def sendUndoBlockViaServer(baseDir: str, session,
if not inboxUrl:
if debug:
print('DEBUG: No ' + postToBox + ' was found for ' + handle)
print('DEBUG: unblock no ' + postToBox +
' was found for ' + handle)
return 3
if not fromPersonId:
if debug:
print('DEBUG: No actor was found for ' + handle)
print('DEBUG: unblock no actor was found for ' + handle)
return 4
authHeader = createBasicAuthHeader(fromNickname, password)
@ -4275,10 +4277,10 @@ def sendUndoBlockViaServer(baseDir: str, session,
postResult = postJson(session, newBlockJson, [], inboxUrl,
headers, 30, True)
if not postResult:
print('WARN: Unable to post block')
print('WARN: unblock unable to post')
if debug:
print('DEBUG: c2s POST block success')
print('DEBUG: c2s POST unblock success')
return newBlockJson

View File

@ -313,11 +313,11 @@ def sendRoleViaServer(baseDir: str, session,
delegatorDomain, projectVersion, debug)
if not wfRequest:
if debug:
print('DEBUG: announce webfinger failed for ' + handle)
print('DEBUG: role webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
print('WARN: Webfinger for ' + handle + ' did not return a dict. ' +
str(wfRequest))
print('WARN: role webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
return 1
postToBox = 'outbox'
@ -334,11 +334,12 @@ def sendRoleViaServer(baseDir: str, session,
if not inboxUrl:
if debug:
print('DEBUG: No ' + postToBox + ' was found for ' + handle)
print('DEBUG: role no ' + postToBox +
' was found for ' + handle)
return 3
if not fromPersonId:
if debug:
print('DEBUG: No actor was found for ' + handle)
print('DEBUG: role no actor was found for ' + handle)
return 4
authHeader = createBasicAuthHeader(delegatorNickname, password)
@ -352,7 +353,7 @@ def sendRoleViaServer(baseDir: str, session,
postJson(session, newRoleJson, [], inboxUrl, headers, 30, True)
if not postResult:
if debug:
print('DEBUG: POST announce failed for c2s to ' + inboxUrl)
print('DEBUG: POST role failed for c2s to ' + inboxUrl)
# return 5
if debug:

View File

@ -361,11 +361,11 @@ def sendShareViaServer(baseDir, session,
fromDomain, projectVersion, debug)
if not wfRequest:
if debug:
print('DEBUG: announce webfinger failed for ' + handle)
print('DEBUG: share webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
print('WARN: Webfinger for ' + handle + ' did not return a dict. ' +
str(wfRequest))
print('WARN: share webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
return 1
postToBox = 'outbox'
@ -381,11 +381,12 @@ def sendShareViaServer(baseDir, session,
if not inboxUrl:
if debug:
print('DEBUG: No ' + postToBox + ' was found for ' + handle)
print('DEBUG: share no ' + postToBox +
' was found for ' + handle)
return 3
if not fromPersonId:
if debug:
print('DEBUG: No actor was found for ' + handle)
print('DEBUG: share no actor was found for ' + handle)
return 4
authHeader = createBasicAuthHeader(fromNickname, password)
@ -409,7 +410,7 @@ def sendShareViaServer(baseDir, session,
postJson(session, newShareJson, [], inboxUrl, headers, 30, True)
if not postResult:
if debug:
print('DEBUG: POST announce failed for c2s to ' + inboxUrl)
print('DEBUG: POST share failed for c2s to ' + inboxUrl)
# return 5
if debug:
@ -460,11 +461,11 @@ def sendUndoShareViaServer(baseDir: str, session,
fromDomain, projectVersion, debug)
if not wfRequest:
if debug:
print('DEBUG: announce webfinger failed for ' + handle)
print('DEBUG: unshare webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
print('WARN: Webfinger for ' + handle + ' did not return a dict. ' +
str(wfRequest))
print('WARN: unshare webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
return 1
postToBox = 'outbox'
@ -480,11 +481,12 @@ def sendUndoShareViaServer(baseDir: str, session,
if not inboxUrl:
if debug:
print('DEBUG: No '+postToBox+' was found for ' + handle)
print('DEBUG: unshare no ' + postToBox +
' was found for ' + handle)
return 3
if not fromPersonId:
if debug:
print('DEBUG: No actor was found for ' + handle)
print('DEBUG: unshare no actor was found for ' + handle)
return 4
authHeader = createBasicAuthHeader(fromNickname, password)
@ -499,11 +501,11 @@ def sendUndoShareViaServer(baseDir: str, session,
headers, 30, True)
if not postResult:
if debug:
print('DEBUG: POST announce failed for c2s to ' + inboxUrl)
print('DEBUG: POST unshare failed for c2s to ' + inboxUrl)
# return 5
if debug:
print('DEBUG: c2s POST undo share success')
print('DEBUG: c2s POST unshare success')
return undoShareJson

View File

@ -126,11 +126,11 @@ def sendSkillViaServer(baseDir: str, session, nickname: str, password: str,
domain, projectVersion, debug)
if not wfRequest:
if debug:
print('DEBUG: announce webfinger failed for ' + handle)
print('DEBUG: skill webfinger failed for ' + handle)
return 1
if not isinstance(wfRequest, dict):
print('WARN: Webfinger for ' + handle + ' did not return a dict. ' +
str(wfRequest))
print('WARN: skill webfinger for ' + handle +
' did not return a dict. ' + str(wfRequest))
return 1
postToBox = 'outbox'
@ -145,11 +145,12 @@ def sendSkillViaServer(baseDir: str, session, nickname: str, password: str,
if not inboxUrl:
if debug:
print('DEBUG: No ' + postToBox + ' was found for ' + handle)
print('DEBUG: skill no ' + postToBox +
' was found for ' + handle)
return 3
if not fromPersonId:
if debug:
print('DEBUG: No actor was found for ' + handle)
print('DEBUG: skill no actor was found for ' + handle)
return 4
authHeader = createBasicAuthHeader(nickname, password)
@ -164,7 +165,7 @@ def sendSkillViaServer(baseDir: str, session, nickname: str, password: str,
headers, 30, True)
if not postResult:
if debug:
print('DEBUG: POST announce failed for c2s to ' + inboxUrl)
print('DEBUG: POST skill failed for c2s to ' + inboxUrl)
# return 5
if debug: