Пример #1
0
 def default_request(self):
     try:
         url = xutils.get_argument("url")
         if url is None or url == "":
             raise Exception("url为空")
         h = HTML2Text(baseurl=url)
         data = xutils.http_get(url)
         text = h.handle(data)
         # return dict(text=text)
     except Exception as e:
         text = "错误:" + str(e)
     web.header("Content-Type", "text/plain; charset=utf-8")
     return text
Пример #2
0
 def test_http_get(self):
     out = xutils.http_get("http://baidu.com")