From c3c26ad2e96027ce1ebba8e433abeac4661be230 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 26 Oct 2019 13:01:22 +0100 Subject: [PATCH] Handle no post result --- session.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/session.py b/session.py index db8b5c87..c00b9420 100644 --- a/session.py +++ b/session.py @@ -68,7 +68,9 @@ def postJson(session,postJsonObject: {},federationList: [],inboxUrl: str,headers return None 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, \ federationList: [], \ @@ -137,5 +139,6 @@ def postImage(session,attachImageFilename: str,federationList: [],inboxUrl: str, with open(attachImageFilename, 'rb') as avFile: mediaBinary = avFile.read() postResult = session.post(url=inboxUrl, data=mediaBinary, headers=headers) - return postResult.text + if postResult: + return postResult.text return None