from flask import Flask
from threading import Thread
import random
import time
import requests
import logging

app = Flask('')
@app.route('/')
def home():
    return "Bot is alive!"

def run():
  app.run(host='0.0.0.0',port=8080) 

def ping(target, debug):
    while(True):
        r = requests.get(target)
        if(debug == True):
            print("Status Code: " + str(r.status_code))
        time.sleep(random.randint(180,300)) #alternate ping time between 3 and 5 minutes
        
def awake(target, debug=False):  
    logger = logging.getLogger('werkzeug')
    logger.disabled = True
    app.logger.disabled = True
    
    t = Thread(target=run)
    r = Thread(target=ping, args=(target,debug,))
    t.start()
    r.start()
from flask import Flask
from threading import Thread
import random
import time
import requests
import logging

app = Flask('')
@app.route('/')
def home():
    return "Bot is alive!"

def run():
  app.run(host='0.0.0.0',port=8080) 

def ping(target, debug):
    while(True):
        r = requests.get(target)
        if(debug == True):
            print("Status Code: " + str(r.status_code))
        time.sleep(random.randint(180,300)) #alternate ping time between 3 and 5 minutes
        
def awake(target, debug=False):  
    logger = logging.getLogger('werkzeug')
    logger.disabled = True
    app.logger.disabled = True
    
    t = Thread(target=run)
    r = Thread(target=ping, args=(target,debug,))
    t.start()
    r.start()
#alternate ping time between 3 and 5 minutes