Return boolean from post

master
Bob Mottram 2019-08-26 13:10:19 +01:00
parent 17d639ba7d
commit 3042b84a16
2 changed files with 4 additions and 4 deletions

View File

@ -920,7 +920,7 @@ def threadSendPost(session,postJsonStr: str,federationList: [],\
if postResult:
if debug:
print('DEBUG: successful json post to '+inboxUrl+' ('+str(postResult)+')')
print('DEBUG: successful json post to '+inboxUrl)
# our work here is done
break
if debug:

View File

@ -70,7 +70,7 @@ def postJsonString(session,postJsonStr: str, \
inboxUrl: str, \
headers: {}, \
capability: str, \
debug: bool) -> str:
debug: bool) -> bool:
"""Post a json message string to the inbox of another person
Supplying a capability, such as "inbox:write"
NOTE: Here we post a string rather than the original json so that
@ -88,8 +88,8 @@ def postJsonString(session,postJsonStr: str, \
postResult = session.post(url = inboxUrl, data = postJsonStr, headers=headers)
if postResult.status_code<200 or postResult.status_code>202:
print('WARN: Failed to post to '+inboxUrl+' status code '+str(postResult.status_code))
return None
return postResult.text
return False
return True
def postImage(session,attachImageFilename: str,federationList: [],inboxUrl: str,headers: {},capability: str) -> str:
"""Post an image to the inbox of another person or outbox via c2s