weatherly
v0.10.0
Weatherly是一個簡單的軟件包,可從Weatherapi.com檢索天氣數據。它提供了易於使用的接口來訪問特定位置的當前和歷史天氣數據。
要在計算機上安裝Weatherly 3.10或更高的計算機。如果您的Python版本滿足要求運行:
# Windows
py -3 -m pip install -U weatherly
# MacOS / Linux
python3 -m pip install -U weatherly恭喜!現在,Weatherly可以在您的機器上使用。
import weatherly
client = weatherly . Client ( api_key = "your WeatherAPI key" )
# you can set language to all requests, or pass it manually
client . set_language ( "fr" ) # lang code
client . set_language ( "German" ) # language full name
# getting weather info
current_weather = client . get_current_weather ( query = "London" )
# getting forecast info
forecast = client . get_forecast_data ( query = "Paris" , days = 3 )
# historical data
history = client . get_historical_data ( query = "48.8567,2.3508" , date = "2010-01-01" ) # query could also be latitude,longitude
# marine data
marine = client . get_marine_data ( query = "Madrid" )