国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

可以用的天氣

2023-05-27 18:03 作者:Bin不是冰  | 我要投稿

import requests

import json

import os

import pickle

if not os.path.exists("first_time.pickle"):
? ?key = input("請(qǐng)輸入和風(fēng)天氣key:")
? ?with open("first_time.pickle", "wb") as f:
? ? ? ?pickle.dump(key, f)
else:
? ?with open("first_time.pickle", "rb") as f:
? ? ? ?key = pickle.load(f)

city = input("請(qǐng)輸入你想查詢的城市名稱:")

url = "https://geoapi.qweather.com/v2/city/lookup"

querystring = {"location":city,"key":key}

headers = {
? ?"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"}

response = requests.request("GET", url, headers=headers, params=querystring)

if "location" in response.json():
? ?city_id = response.json()["location"][0]["id"]
else:
? ?print("獲取城市ID失敗,請(qǐng)檢查你的請(qǐng)求參數(shù)和API Key是否正確。")
? ?exit()

url = "https://devapi.qweather.com/v7/weather/now"

querystring = {"location":city_id,"key":key}

response = requests.request("GET", url, headers=headers, params=querystring)

response = requests.request("GET", url, headers=headers, params=querystring)

data = json.loads(response.text)
code = data["code"]
update_time = data["updateTime"]
fx_link = data["fxLink"]
now_data = data["now"]
obs_time = now_data["obsTime"]
temp = now_data["temp"]
feels_like = now_data["feelsLike"]
icon = now_data["icon"]
text = now_data["text"]
wind360 = now_data["wind360"]
wind_dir = now_data["windDir"]
wind_scale = now_data["windScale"]
wind_speed = now_data["windSpeed"]
humidity = now_data["humidity"]
precip = now_data["precip"]
pressure = now_data["pressure"]
vis = now_data["vis"]
cloud = now_data["cloud"]
dew = now_data["dew"]

print("網(wǎng)頁視圖鏈接",fx_link)
print("天氣更新時(shí)間",obs_time)
print("當(dāng)前溫度為",temp,"℃")
print("體感溫度",feels_like,"℃")
print("天氣狀況",text)
print("風(fēng)向360角度",wind360,"°")
print("風(fēng)向",wind_dir)
print("風(fēng)力等級(jí)",wind_scale)
print("風(fēng)速",wind_speed,"公里/小時(shí)")
print("相對(duì)濕度",humidity,"%")
print("當(dāng)前小時(shí)累計(jì)降水量",precip,"毫米")
print("大氣壓強(qiáng)",pressure,"百帕")
print("能見度",vis,"公里")
print("云量",cloud,"%")
print("露點(diǎn)濕度",dew)


可以用的天氣的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
连平县| 林口县| 共和县| 金秀| 嵊州市| 临潭县| 开鲁县| 常山县| 鹤岗市| 江源县| 孝义市| 台南县| 浮山县| 彰化县| 聂拉木县| 宜兰市| 府谷县| 泾阳县| 巢湖市| 朝阳市| 安西县| 易门县| 信阳市| 大同市| 犍为县| 九江县| 桃园市| 双城市| 隆昌县| 兴化市| 区。| 武陟县| 黔西| 连州市| 通州市| 正安县| 辽宁省| 潮安县| 南川市| 手机| 七台河市|