Error handling on post

master
Bob Mottram 2019-08-26 12:14:33 +01:00
parent 12cce673e5
commit 5561d7e317
1 changed files with 5 additions and 0 deletions

View File

@ -86,6 +86,11 @@ def postJsonString(session,postJsonStr: str, \
return None return None
postResult = session.post(url = inboxUrl, data = postJsonStr, headers=headers) postResult = session.post(url = inboxUrl, data = postJsonStr, headers=headers)
if postResult:
if 'not found' in postResult.text:
print('WARN: Failed to post to '+inboxUrl)
print(postResult.text)
return None
return postResult.text return postResult.text
def postImage(session,attachImageFilename: str,federationList: [],inboxUrl: str,headers: {},capability: str) -> str: def postImage(session,attachImageFilename: str,federationList: [],inboxUrl: str,headers: {},capability: str) -> str: