Add logic to download and store daily updates as JSON

- Introduce filename and URL generation based on the current date.
- Update example usage to include download and storage functionality.
This commit is contained in:
TzuWei 2026-03-01 00:13:06 +09:00
parent 7abeb4c456
commit 04738b0542
Signed by: tzuwei-huang
GPG Key ID: 88A0D3DA7558EE01

View File

@ -1,3 +1,5 @@
from datetime import date
import datetime
import json
import requests
import os
@ -194,7 +196,12 @@ class MetarDownloader:
if __name__ == "__main__":
# Example usage
date_str = datetime.datetime.now().strftime("%Y_%m_%d")
filename = f"{date_str}_update.json"
url = f"https://www.taoyuan-airport.com/uploads/fos/{date_str}_update.xls"
downloader = FileDownloader()
_ = downloader.download_and_store_as_json(url, filename, verify=False)
metar_downloader = MetarDownloader()
m, t = metar_downloader.fetch_metar_taf("RCTP")
if m: