#!/usr/bin/python
# encoding:utf-8
import urllib2, json, urllib
# 2、星座运势查询
data = {}
data["appkey"] = "your_appkey_here"
data["astroid"] = 1
data["date"] = "2016-01-19"
url_values = urllib.urlencode(data)
url = "https://api.jisuapi.com/astro/fortune" + "?" + url_values
request = urllib2.Request(url)
result = urllib2.urlopen(request)
jsonarr = json.loads(result.read())
if jsonarr["status"] != 0:
print(jsonarr["msg"])
exit()
result = jsonarr["result"]
print(result
print(result["astroid"],result["astroname"]
today = result["today"]
tomorrow = result["tomorrow"]
month = result["month"]
print("今日运势:"
print(today["date"],today["presummary"],today["star"],today["color"],today["number"],today["summary"],today["money"],today["career"],today["love"],today["health"]
print("明日运势:"
print(tomorrow["date"],tomorrow["presummary"],tomorrow["star"],tomorrow["color"],tomorrow["number"],tomorrow["summary"],tomorrow["money"],tomorrow["career"],tomorrow["love"],tomorrow["health"]
if result.has_key("week"):
week = result["week"]
print("本周运势:"
print(week["date"],week["job"],week["money"],week["career"],week["love"],week["health"]
print("本月运势:"
print(month["date"],month["summary"],month["money"],month["career"],month["love"],month["health"]
if result.has_key("year"):
year = result["year"]
print("本年运势:"
print(year["date"],year["summary"],year["money"],year["career"],year["love"]) 

© 2015-2025 杭州极速互联科技有限公司 版权所有 浙ICP备17047587号-4 浙公网安备33010502005096 增值电信业务经营许可证:浙B2-20190875