python调用阿里云天气预报接口,注册天气预报appid 获取appcode
# -*- coding:UTF-8 -*- from urllib.request import urlretrieve import re import requests import json appcode = '56934a4ca2fb4db4bd3e333333333' url = "https://qryweather.market.alicloudapi.com/lundroid/queryweather?" + "areaid=333333" headers = { 'Content-Type': 'application/json', "Authorization": "APPCODE " + appcode } # req = urllib.request.Request(url,headers=headers) req = requests.get(url=url,headers = headers) text = json.loads(req.content) print(text)
请赞赏
朋友,创作不易;为犒赏小编的辛勤劳动,请她喝杯咖啡吧!
给她赞赏,您将财运亨通