mirror of https://gitlab.com/bashrc2/epicyon
json post timeout
parent
f534899681
commit
62ae21dd3e
2
like.py
2
like.py
|
@ -203,7 +203,7 @@ def sendLikeViaServer(baseDir: str, session,
|
||||||
'Content-type': 'application/json',
|
'Content-type': 'application/json',
|
||||||
'Authorization': authHeader
|
'Authorization': authHeader
|
||||||
}
|
}
|
||||||
postResult = postJson(session, newLikeJson, [], inboxUrl, headers)
|
postResult = postJson(session, newLikeJson, [], inboxUrl, headers, 30)
|
||||||
if not postResult:
|
if not postResult:
|
||||||
print('WARN: POST announce failed for c2s to ' + inboxUrl)
|
print('WARN: POST announce failed for c2s to ' + inboxUrl)
|
||||||
return 5
|
return 5
|
||||||
|
|
|
@ -348,7 +348,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
|
||||||
_sayCommand(sayStr, screenreader,
|
_sayCommand(sayStr, screenreader,
|
||||||
systemLanguage, espeak)
|
systemLanguage, espeak)
|
||||||
if screenreader:
|
if screenreader:
|
||||||
keyPress = _waitForKeypress(2, debug)
|
keyPress = _waitForKeypress(2, dbug)
|
||||||
break
|
break
|
||||||
elif keyPress == 'reply' or keyPress == 'r':
|
elif keyPress == 'reply' or keyPress == 'r':
|
||||||
if speakerJson.get('id'):
|
if speakerJson.get('id'):
|
||||||
|
|
|
@ -137,7 +137,7 @@ def getJson(session, url: str, headers: {}, params: {},
|
||||||
|
|
||||||
|
|
||||||
def postJson(session, postJsonObject: {}, federationList: [],
|
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
|
"""Post a json message to the inbox of another person
|
||||||
"""
|
"""
|
||||||
# check that we are posting to a permitted domain
|
# check that we are posting to a permitted domain
|
||||||
|
@ -149,7 +149,7 @@ def postJson(session, postJsonObject: {}, federationList: [],
|
||||||
postResult = \
|
postResult = \
|
||||||
session.post(url=inboxUrl,
|
session.post(url=inboxUrl,
|
||||||
data=json.dumps(postJsonObject),
|
data=json.dumps(postJsonObject),
|
||||||
headers=headers)
|
headers=headers, timeout=timeoutSec)
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
print('ERROR: postJson requests failed ' + inboxUrl + ' ' +
|
print('ERROR: postJson requests failed ' + inboxUrl + ' ' +
|
||||||
json.dumps(postJsonObject) + ' ' + str(headers))
|
json.dumps(postJsonObject) + ' ' + str(headers))
|
||||||
|
|
Loading…
Reference in New Issue