

















def fetch_post_request(path, post):
http = tornado.httpclient.HTTPClient()
if not obj:
obj = db.Post()
else:
if 'hash' in obj['metadata'].keys():
uri = "http://localhost:5000/%s/post/%s?cmd=original&hash=%s" % \
(path, slug, obj.metadata['hash'])
try:
response = http.fetch(uri)
print unicode(uri, "utf-8")
response.rethrow()
obj.body = unicode(response.body, "utf-8")
print json.loads(response.headers["x-dropbox-metadata"])
obj.metadata = json.loads(response.headers["x-dropbox-metadata"])
obj.save()
=====
通过 tornado.httpclient.HTTPClient() 的代码 在执行过程中带有中文url路径就不能处理编码
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。