weatherly
v0.10.0
Weatherly เป็นแพ็คเกจง่ายๆที่ดึงข้อมูลสภาพอากาศจาก Weatherapi.com มันให้อินเทอร์เฟซที่ใช้งานง่ายเพื่อเข้าถึงข้อมูลสภาพอากาศในปัจจุบันและประวัติสำหรับสถานที่เฉพาะ
ในการติดตั้ง Weatherly บน Python คอมพิวเตอร์ 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" )