mirror of https://gitlab.com/bashrc2/epicyon
Use status code
parent
d8f917e4e2
commit
815c231f55
13
session.py
13
session.py
|
@ -86,16 +86,9 @@ 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)
|
||||||
postResultCode=str(postResult)
|
if postResult.status_code<200 or postResult.status_code>202:
|
||||||
print('http: '+postResultCode)
|
print('WARN: Failed to post to '+inboxUrl)
|
||||||
if '[' in postResultCode and ']' in postResultCode:
|
return None
|
||||||
postResultCode=postResultCode.split('[')[1]
|
|
||||||
postResultCode=postResultCode.split(']')[0]
|
|
||||||
if postResultCode.isdigit():
|
|
||||||
postResultCode=int(postResultCode)
|
|
||||||
if postResultCode<200 or postResultCode>202:
|
|
||||||
print('WARN: Failed to post to '+inboxUrl)
|
|
||||||
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:
|
||||||
|
|
Loading…
Reference in New Issue