遇到函数不执行
调用函数才执行
def apiPhone(city, key):
url = 'http://apis.juhe.cn/simpleWeather/query'
par = {
"city": city,
"key": key
}
r = requests.get(url=url, params=par)
return r
# 正常流
r = apiPhone("深圳", "99485d9e2ebabfd0fc86eeb88f0dab41")
print(r.text)
# 异常流 key错误
r = apiPhone("深圳", "199485d9e2ebabfd0fc86eeb88f0dab41")
print(r.text)