I did so many versions of this script, but all got some issues.
import requests
#import schedule
import time
from bs4 import BeautifulSoup
def countdown():
for i in reversed(range(0, 1)):
time.sleep(1)
print("%s\r" %i)
def reconnect():
r = requests.get("http://hotspot.de/login?dst=http%3A%2F%2Fgoogle.com%2F&username=here")
soup = BeautifulSoup(r.content, "html.parser")
print(r),(r.content)
print(soup.prettify())
print (type(soup))
countdown()
reconnect()
return
reconnect()
This one works nice but stops after some time with error about reaching maximum recursion limit, and im definitely too noob in python to know how to fix it.
And the version with just one scheduled request got some weird time issue, when I use the script to connect and schedule it to send next get in exactly 30 minutes it doesnt follow the server time, after running 2 hours the discord is minutes long.I think better way for doing precised request would be to scrap some site and basing on length of this GET, send request only if it gets error, so it would be a most notebook friendly method.
The very first version with tons of GET every second, was eating up to 30% and always has some serverside ban risk so its not good at all.
I will try to get to work somehow this version posted above, thus I dont know how yet, there are some articles warning about forcing higher recursion depth on a python interpreter
And just a fast thought, maybe will TRY do some exception to make run the script again after falling down, but idk if its possible here.