diff --git a/init.py b/init.py index 845109c..78f26d6 100644 --- a/init.py +++ b/init.py @@ -4,8 +4,11 @@ from time import sleep while True: req = requests.get("http://ipinfo.io/ip") - ip = req.text + while int(req.status_code) != 200: + sleep(60) + req = requests.get("http://ipinfo.io/ip") + ip = req.text # existe archivo con la antigua ip file_exists = exists("old_ip.txt") if not file_exists: @@ -18,7 +21,7 @@ while True: # si existe y esta vacia with open("old_ip.txt", "r") as f: contenido = f.read() - if contenido == '': + if contenido == "": f = open("old_ip.txt", "w") f.write("ip vacia") f.close()