diff --git a/posts.py b/posts.py index fcfe3bce4..e31a4e888 100644 --- a/posts.py +++ b/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) diff --git a/session.py b/session.py index 2661c6ffc..14e5b8666 100644 --- a/session.py +++ b/session.py @@ -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)