I have a problem with my telegram bot. Just using
bot = telebot.TeleBot(TOKEN)
bot.polling(none_stop=False ,interval=2)
When the internet connection is down, the script crashes, because polling fails.
I want to add some code to check if the internet connection is available before bot polling,
import urllib
try :
url = "https://www.google.com"
urllib.urlopen(url)
status = "Connected"
except :
status = "Not connect"
something like:
"if" status is "connected" ---> bot polling.
else ----> wait and try again in "seconds"