def put_session(self, session, retry=True):
try:
r = requests.put(self.url + "/conns", auth=self.auth, json=session, timeout=20.0)
except requests.exceptions.RequestException:
dbg("Cannot connect to backend")
return []
if r.status_code == 200:
return r.json()
elif retry:
msg = r.raw.read()
dbg("Backend upload failed, retrying (" + str(msg) + ")")
return self.put_session(session, False)
else:
msg = r.raw.read()
raise IOError(msg)
评论列表
文章目录