| | from weather_data_fetcher import WeatherDataFetcher |
| | from datetime import datetime |
| |
|
| | def main(): |
| | api_key = 'e3ade4ad29e02a1ad5127ec56fbc0064' |
| | fetcher = WeatherDataFetcher(api_key) |
| | cities = ['Raleigh,NC,US', 'Asheville,NC,US','New Bern,NC,US','Winnabow,NC,US' |
| | 'Chapel Hill,NC,US','Charlotte,NC,US','Greenville,NC,US','Greensboro,NC,US', |
| | 'Wilmington,NC,US','Durham,NC,US'] |
| | |
| | start_date = datetime(2023, 3, 19) |
| | end_date = datetime(2024, 3, 16) |
| |
|
| | all_cities_df = fetcher.fetch_weather_for_cities(cities, start_date, end_date) |
| | |
| | if not all_cities_df.empty: |
| | print(all_cities_df.head()) |
| | else: |
| | print("No weather data retrieved for any city.") |
| | file_name = 'weather_data.csv' |
| | fetcher.save_to_csv(all_cities_df, file_name) |
| |
|
| | if __name__ == '__main__': |
| | main() |