This topic created in 4842 days ago, the information mentioned may be changed or developed.
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路径就不能处理编码
1 replies • 1970-01-01 08:00:00 +08:00
 |
|
1
notedit Feb 2, 2013
记得urlencode 一下
|