mirror of https://gitlab.com/bashrc2/epicyon
Timeout when sending post via c2s
parent
0b7cf977fb
commit
63b7aa6d94
2
posts.py
2
posts.py
|
@ -2141,7 +2141,7 @@ def sendPostViaServer(projectVersion: str,
|
|||
postDumps = json.dumps(postJsonObject)
|
||||
postResult = \
|
||||
postJsonString(session, postDumps, [],
|
||||
inboxUrl, headers, debug)
|
||||
inboxUrl, headers, debug, 60)
|
||||
if not postResult:
|
||||
if debug:
|
||||
print('DEBUG: POST failed for c2s to '+inboxUrl)
|
||||
|
|
|
@ -173,7 +173,8 @@ def postJsonString(session, postJsonStr: str,
|
|||
federationList: [],
|
||||
inboxUrl: str,
|
||||
headers: {},
|
||||
debug: bool) -> (bool, bool):
|
||||
debug: bool,
|
||||
timeoutSec=30) -> (bool, bool):
|
||||
"""Post a json message string to the inbox of another person
|
||||
The second boolean returned is true if the send is unauthorized
|
||||
NOTE: Here we post a string rather than the original json so that
|
||||
|
@ -182,7 +183,8 @@ def postJsonString(session, postJsonStr: str,
|
|||
"""
|
||||
try:
|
||||
postResult = \
|
||||
session.post(url=inboxUrl, data=postJsonStr, headers=headers)
|
||||
session.post(url=inboxUrl, data=postJsonStr,
|
||||
headers=headers, timeout=timeoutSec)
|
||||
except requests.exceptions.RequestException as e:
|
||||
print('WARN: error during postJsonString requests')
|
||||
print(e)
|
||||
|
|
Loading…
Reference in New Issue