#!/usr/bin/python
# encoding:utf-8
import urllib2, json, urllib
# 1、天气预报查询
data = {}
data["appkey"] = "your_appkey_here"
data["city"] = "杭州"
data["cityid"] = "111"#任选
data["citycode"] ="101260301"#任选
url_values = urllib.urlencode(data)
url = "http://api.binstd.com/weather/query" + "?" + url_values
result = urllib2.urlopen(url)
jsonarr = json.loads(result.read())
if jsonarr["status"] != u"0":
print jsonarr["msg"]
exit()
result = jsonarr["result"]
print result["city"],result["cityid"],result["citycode"],result["date"],result["week"],result["weather"],result["temp"]
print result[