【发布时间】:2013-11-24 08:11:19
【问题描述】:
我的 API 需要返回 json 类型的东西,所以我将 Content-Type 设置为 application/json?
这是我的url,我不希望字符被转义。
我使用 webpy 框架。
def GET(self):
web.header('Content-Type', 'application/json')
url = "http://www.reddit.com/r/pics/hot.json"
hdr = { 'User-Agent' : 'super happy flair bot by /u/spladug' }
req = urllib2.Request(url, headers=hdr)
html = urllib2.urlopen(req).read()
gold = json.loads(html)
return render.callback(gold)
这是示例输出:
{u'kind': u'Listing'}
我不想让角色转义。
有人可以帮我吗?
【问题讨论】:
-
好像新浪App对我有问题,但我没有经验,文档都是中文的。
-
@frb thx,我把输出加到问题里了,你能看看吗?
标签: python html json jsonp web.py