updated scripts
This commit is contained in:
parent
2a7bd2c250
commit
5b03adaaa9
3 changed files with 16 additions and 2 deletions
|
|
@ -4,7 +4,9 @@ import subprocess
|
|||
import json
|
||||
import os
|
||||
import asyncio
|
||||
from time import sleep
|
||||
from dotenv import load_dotenv
|
||||
import urllib3
|
||||
|
||||
load_dotenv() # Loads up .env file
|
||||
|
||||
|
|
@ -86,8 +88,19 @@ async def newIPCheck():
|
|||
getCurrentIP() # update current ip
|
||||
await newIPCheck()
|
||||
|
||||
def waitForConnection():
|
||||
while True:
|
||||
try:
|
||||
response = urllib3.request("GET", "https://ifconfig.me")
|
||||
return
|
||||
except urllib3.exceptions.MaxRetryError:
|
||||
print("Failed connection!")
|
||||
sleep(1)
|
||||
pass
|
||||
|
||||
def main():
|
||||
waitForConnection()
|
||||
|
||||
if not os.path.exists("public_ip"):
|
||||
getCurrentIP()
|
||||
elif not os.path.exists(".env"):
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
if [ ! -d .venv ]; then
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install -U python-dotenv
|
||||
pip install --upgrade pip # Update pip to the latest version
|
||||
pip install -U python-dotenv urllib3
|
||||
pip install -U pip # Update pip to the latest version
|
||||
fi
|
||||
|
||||
echo 'Make sure to run ". .venv/bin/activate" to enter the development environment'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue