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" )