From 5f31820ec686c6d02f697fe2356c667c9bae0527 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 21 Oct 2019 17:48:41 +0100 Subject: [PATCH] Try ld+json post --- session.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/session.py b/session.py index b3f9129e..5591b19c 100644 --- a/session.py +++ b/session.py @@ -92,6 +92,11 @@ def postJsonString(session,postJsonStr: str, \ postResult = session.post(url = inboxUrl, data = postJsonStr, headers=headers) if postResult.status_code<200 or postResult.status_code>202: + if postResult.status_code==400: + headers['content-type']='application/ld+json' + postResult = session.post(url = inboxUrl, data = postJsonStr, headers=headers) + if not (postResult.status_code<200 or postResult.status_code>202): + return True if postResult.status_code==401: print('WARN: >>> Post to '+inboxUrl+' is unauthorized <<<') else: