From b08252f98fb7e0bd29f316c70578ba4c0e645816 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Wed, 29 Jan 2025 16:50:09 +0100 Subject: [PATCH] update cron job --- app/cron_potus_tracker.py | 41 +++++++++++++++++++++------------------ app/primary_cron_job.py | 1 - 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/app/cron_potus_tracker.py b/app/cron_potus_tracker.py index 6c373c5..955fa8b 100644 --- a/app/cron_potus_tracker.py +++ b/app/cron_potus_tracker.py @@ -165,32 +165,35 @@ async def get_data(): for address in [details, location]: - if any(place in address for place in ["White House", "Blair House","Washington DC"]): - location = "Washington, DC" - else: - location = address # Otherwise, use the full address string + try: + if any(place in address for place in ["White House", "Blair House","Washington DC", "East Room"]): + location = "Washington, DC" + else: + location = address # Otherwise, use the full address string - # Geocode the processed address - location_data = geolocator.geocode(location) - city = location_data.address.split(',', 1)[0] - if location_data: - - # Extract city from the address components - address_components = location_data.raw.get('address', {}) - - - # Extract latitude and longitude - latitude = location_data.latitude - longitude = location_data.longitude - print(f"Latitude: {latitude}, Longitude: {longitude}") - break + # Geocode the processed address + location_data = geolocator.geocode(location) + city = location_data.address.split(',', 1)[0] + if location_data: + + # Extract city from the address components + address_components = location_data.raw.get('address', {}) + + + # Extract latitude and longitude + latitude = location_data.latitude + longitude = location_data.longitude + print(f"Latitude: {latitude}, Longitude: {longitude}") + break + except: + pass for item in data: for price_item in sp500_list: if item['date'] == price_item['date']: item['changesPercentage'] = price_item['changesPercentage'] break - + print(city) res_dict = {'returnSince': return_since,'city': city, 'lon': longitude, 'lat': latitude, 'history': data, 'billData': bill_data} save_json(res_dict) diff --git a/app/primary_cron_job.py b/app/primary_cron_job.py index c486fad..5c7bbbe 100755 --- a/app/primary_cron_job.py +++ b/app/primary_cron_job.py @@ -382,7 +382,6 @@ schedule.every().day.at("10:00").do(run_threaded, run_fda_calendar).tag('fda_job schedule.every().day.at("12:00").do(run_threaded, run_market_cap).tag('market_cap_job') -#schedule.every().day.at("05:00").do(run_threaded, run_implied_volatility).tag('implied_volatility_job') schedule.every().day.at("13:40").do(run_threaded, run_analyst_estimate).tag('analyst_estimate_job')