Handle no post result

main2
Bob Mottram 2019-10-26 13:01:22 +01:00
parent a21b7fd958
commit c3c26ad2e9
1 changed files with 5 additions and 2 deletions

View File

@ -68,7 +68,9 @@ def postJson(session,postJsonObject: {},federationList: [],inboxUrl: str,headers
return None return None
postResult = session.post(url = inboxUrl, data = json.dumps(postJsonObject), headers=headers) postResult = session.post(url = inboxUrl, data = json.dumps(postJsonObject), headers=headers)
return postResult.text if postResult:
return postResult.text
return None
def postJsonString(session,postJsonStr: str, \ def postJsonString(session,postJsonStr: str, \
federationList: [], \ federationList: [], \
@ -137,5 +139,6 @@ def postImage(session,attachImageFilename: str,federationList: [],inboxUrl: str,
with open(attachImageFilename, 'rb') as avFile: with open(attachImageFilename, 'rb') as avFile:
mediaBinary = avFile.read() mediaBinary = avFile.read()
postResult = session.post(url=inboxUrl, data=mediaBinary, headers=headers) postResult = session.post(url=inboxUrl, data=mediaBinary, headers=headers)
return postResult.text if postResult:
return postResult.text
return None return None