json post timeout

merge-requests/30/head
Bob Mottram 2021-03-10 18:41:13 +00:00
parent f534899681
commit 62ae21dd3e
3 changed files with 4 additions and 4 deletions

View File

@ -203,7 +203,7 @@ def sendLikeViaServer(baseDir: str, session,
'Content-type': 'application/json',
'Authorization': authHeader
}
postResult = postJson(session, newLikeJson, [], inboxUrl, headers)
postResult = postJson(session, newLikeJson, [], inboxUrl, headers, 30)
if not postResult:
print('WARN: POST announce failed for c2s to ' + inboxUrl)
return 5

View File

@ -348,7 +348,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
_sayCommand(sayStr, screenreader,
systemLanguage, espeak)
if screenreader:
keyPress = _waitForKeypress(2, debug)
keyPress = _waitForKeypress(2, dbug)
break
elif keyPress == 'reply' or keyPress == 'r':
if speakerJson.get('id'):

View File

@ -137,7 +137,7 @@ def getJson(session, url: str, headers: {}, params: {},
def postJson(session, postJsonObject: {}, federationList: [],
inboxUrl: str, headers: {}) -> str:
inboxUrl: str, headers: {}, timeoutSec=60) -> str:
"""Post a json message to the inbox of another person
"""
# check that we are posting to a permitted domain
@ -149,7 +149,7 @@ def postJson(session, postJsonObject: {}, federationList: [],
postResult = \
session.post(url=inboxUrl,
data=json.dumps(postJsonObject),
headers=headers)
headers=headers, timeout=timeoutSec)
except requests.exceptions.RequestException as e:
print('ERROR: postJson requests failed ' + inboxUrl + ' ' +
json.dumps(postJsonObject) + ' ' + str(headers))