From 5b141c3d309077ace1db1699cfd241afe3a87531 Mon Sep 17 00:00:00 2001 From: joey0629 Date: Wed, 10 Apr 2024 19:56:44 +0800 Subject: [PATCH] cpi update chrome version update v7 --- main.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 3624e5f..3190b4a 100644 --- a/main.py +++ b/main.py @@ -256,6 +256,7 @@ def broadcast_all_cpi(target:str): broadcast_message( f"Now :{datetime.fromtimestamp(time.time())} , Spend time :{str(round(endtimee - startimee, 3))} s", "-1002033782195") + return True def broadcast_all_fomc(target:str): startimee = time.time() date , message = find_fomc(fomc_url,'20240131a') @@ -299,6 +300,13 @@ def broadcast_all_bs4_pce(target:str): broadcast_message( f"Now :{datetime.fromtimestamp(time.time())} , Spend time :{str(round(endtimee - startimee, 3))} s", "-1002033782195") +has_broadcasted = False + +def wrapper_function(target): + global has_broadcasted + result = broadcast_all_cpi(target) + if result: + has_broadcasted = True if __name__ == "__main__": global nonfarm_url , cpi_url , fomc_url , pce_url nonfarm_url = "https://www.bls.gov/news.release/empsit.nr0.htm" @@ -307,10 +315,13 @@ if __name__ == "__main__": pce_url = "https://www.bea.gov/news/2024/personal-income-and-outlays-"#january-2024 # broadcast_all_pce("February", "february-2024") print("Start Time:" , datetime.fromtimestamp(time.time())) - schedule.every().day.at("19:47").do(broadcast_all_cpi, "FEBRUARY") + schedule.every().day.at("19:56").do(wrapper_function, "FEBRUARY") while True: - if datetime.now().strftime("%Y-%m-%d %H:%M") == "2024-04-10 19:47": + if datetime.now().strftime("%Y-%m-%d %H:%M") == "2024-04-10 19:56": schedule.run_pending() + if has_broadcasted: + print("Broadcast completed") + break time.sleep(0.1) # Check every 0.1 seconds #NonFarm # text = download_pdf_nonfarm()