来自 Mashape 团队的一个轻量级的 HTTP 库,实现了一个很简洁的异步接口。
def callback_function(response):
  response.code # The HTTP status code
  response.headers # The HTTP headers
  response.body # The parsed response
  response.raw_body # The unparsed response
thread = unirest.post("http://httpbin.org/post",
                       headers={ "Accept": "application/json" },
                       params={ "parameter": 23, "foo": "bar" },
                       callback=callback_function)
|  |      1xiaket      2015-02-05 08:18:59 +08:00 API好干净 | 
|      2caizixian      2015-02-05 08:31:57 +08:00 看起来很不错啊 | 
|  |      3CosWind      2015-02-05 09:04:21 +08:00 赞一个 | 
|  |      4clino      2015-02-05 09:09:35 +08:00 用callback多了还是感觉会比较虐心 | 
|  |      5sujin190      2015-02-05 09:44:18 +08:00 开新线程做callback。。 | 
|  |      6ipconfiger      2015-02-05 10:07:33 +08:00 callback会传染的 |