forked from indymedia/epicyon
Return boolean from post
parent
17d639ba7d
commit
3042b84a16
2
posts.py
2
posts.py
|
@ -920,7 +920,7 @@ def threadSendPost(session,postJsonStr: str,federationList: [],\
|
|||
|
||||
if postResult:
|
||||
if debug:
|
||||
print('DEBUG: successful json post to '+inboxUrl+' ('+str(postResult)+')')
|
||||
print('DEBUG: successful json post to '+inboxUrl)
|
||||
# our work here is done
|
||||
break
|
||||
if debug:
|
||||
|
|
|
@ -70,7 +70,7 @@ def postJsonString(session,postJsonStr: str, \
|
|||
inboxUrl: str, \
|
||||
headers: {}, \
|
||||
capability: str, \
|
||||
debug: bool) -> str:
|
||||
debug: bool) -> bool:
|
||||
"""Post a json message string to the inbox of another person
|
||||
Supplying a capability, such as "inbox:write"
|
||||
NOTE: Here we post a string rather than the original json so that
|
||||
|
@ -88,8 +88,8 @@ def postJsonString(session,postJsonStr: str, \
|
|||
postResult = session.post(url = inboxUrl, data = postJsonStr, headers=headers)
|
||||
if postResult.status_code<200 or postResult.status_code>202:
|
||||
print('WARN: Failed to post to '+inboxUrl+' status code '+str(postResult.status_code))
|
||||
return None
|
||||
return postResult.text
|
||||
return False
|
||||
return True
|
||||
|
||||
def postImage(session,attachImageFilename: str,federationList: [],inboxUrl: str,headers: {},capability: str) -> str:
|
||||
"""Post an image to the inbox of another person or outbox via c2s
|
||||
|
|
Loading…
Reference in New Issue