Skip to content

Commit

Permalink
failsafe fix for empty response received
Browse files Browse the repository at this point in the history
  • Loading branch information
nekromoff committed Aug 23, 2024
1 parent 42452f9 commit db50707
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions report.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@
if "X-Update" in response.headers and response.headers["X-Update"][2]=="1" and config['auto_update']==True:
response=requests.get(config["receiver"]+'?update=3', headers = headers)
try:
subprocess.run('cp report.py report.py.bak', shell = True)
f = open("report.py", "w")
f.write(response.text)
f.close()
if len(response.text)>0:
subprocess.run('cp report.py report.py.bak', shell = True)
f = open("report.py", "w")
f.write(response.text)
f.close()
except Exception:
# ignore, skip
pass
Expand Down

0 comments on commit db50707

Please sign in to comment.