Exemplo n.º 1
0
def main():
    D = DB('Poland')
    last_update = D.get_last_record_date()

    try:
        pickle_file = open(
            os.path.dirname(os.path.abspath(__file__)) +
            '\Process_Object.pickle', 'rb')
        Pl = pickle.load(pickle_file)
        pickle_file.close()

        new_cases_pred = Pl.cases_pred
        new_deaths_pred = Pl.deaths_pred
        tomorrow_date = datetime.date.today() + datetime.timedelta(days=1)
    except FileNotFoundError:
        print('File doesnt exist')
        new_cases_pred = 'Error'
        new_deaths_pred = 'Error'
        tomorrow_date = 'Error'

    if os.path.isfile(Pl.path + '\Process_Object.pickle'):
        os.remove()

    return render_template('index.html', **locals())
Exemplo n.º 2
0
    win32gui.ShowWindow(the_program_to_hide, win32con.SW_RESTORE)


def hide_term():
    win32gui.ShowWindow(the_program_to_hide, win32con.SW_HIDE)


if __name__ == '__main__':
    scrap_time = '11:15'
    update_time = '18:30'
    today = datetime.datetime.today()
    today_ = today.strftime('%d.%m.%Y')

    keys = ['New cases', 'New deaths']
    W = DB('Poland')
    last_day_db = W.get_last_record_date()
    message = 'Wait for a next scrap...'

    while (True):
        print(message)
        hour_now = datetime.datetime.now().hour
        min_now = datetime.datetime.now().minute
        time_now = str(hour_now) + ':' + str(min_now)
        try:
            if time_now >= scrap_time and W.get_last_record_date() != today_:
                os.system('cls')
                D = DR('Poland')
                D.show_raport()
                W.insert(D)
                Pl = P(W)
                Pl.RBF_prediction(keys)