import requests
import json
import city
cityname = input("你住在哪里呀?")
city_code = city.citycode[cityname]
url = "http://t.weather.sojson.com/api/weather/city/" + city_code
response = requests.get(url)
d = response.json()
print(d)
dd = '城市:'+ d['cityInfo']['city'] + '\n'\
+ '温度:'+d['data']['wendu']
print(dd)
import itchat
import weather
itchat.auto_login(hotReload=True)
friends_list = itchat.get_friends(update=True)
name = itchat.search_friends(name=u'阿樱')
Aying = name[0]["UserName"]
message_list = weather.main('广州')
itchat.send(message_list,Aying)