From 4804070fd164ba4e947c3fbd5aa5049ce4a3ddf8 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 18 Mar 2021 10:01:01 +0000 Subject: [PATCH] Improve c2s debug messages --- announce.py | 11 ++++++----- availability.py | 13 +++++++------ delete.py | 13 +++++++------ follow.py | 28 +++++++++++++++------------- like.py | 24 ++++++++++++------------ posts.py | 40 +++++++++++++++++++++------------------- roles.py | 13 +++++++------ shares.py | 28 +++++++++++++++------------- skills.py | 13 +++++++------ 9 files changed, 97 insertions(+), 86 deletions(-) diff --git a/announce.py b/announce.py index 60679e4de..d07f855a1 100644 --- a/announce.py +++ b/announce.py @@ -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') diff --git a/availability.py b/availability.py index 5b88c4103..7b8196448 100644 --- a/availability.py +++ b/availability.py @@ -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') diff --git a/delete.py b/delete.py index 737f574e8..d904c5275 100644 --- a/delete.py +++ b/delete.py @@ -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: diff --git a/follow.py b/follow.py index 6da40f642..ab2b5d595 100644 --- a/follow.py +++ b/follow.py @@ -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: diff --git a/like.py b/like.py index acf243f52..2bc561de5 100644 --- a/like.py +++ b/like.py @@ -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 diff --git a/posts.py b/posts.py index 9de97b77c..cf6c63d3b 100644 --- a/posts.py +++ b/posts.py @@ -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 diff --git a/roles.py b/roles.py index 218ff7d3a..f198fe7f0 100644 --- a/roles.py +++ b/roles.py @@ -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: diff --git a/shares.py b/shares.py index 239f79a70..ecf59dfc1 100644 --- a/shares.py +++ b/shares.py @@ -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 diff --git a/skills.py b/skills.py index 267c43f37..0609bfd5a 100644 --- a/skills.py +++ b/skills.py @@ -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: