Home  >  Q&A  >  body text

python - tornado.httpclient.AsyncHTTPClient如何使用代理请求一个http服务?

迷茫迷茫2742 days ago942

reply all(3)I'll reply

  • 迷茫

    迷茫2017-04-17 17:14:00

    proxy_host (string) – HTTP proxy hostname. To use proxies, proxy_host and proxy_port must be set; proxy_username and proxy_pass are optional. Proxies are currently only supported with curl_httpclient.
    

    To select curl_httpclient, call AsyncHTTPClient.configure at startup:

    AsyncHTTPClient.configure("tornado.curl_httpclient.CurlAsyncHTTPClient")

    Just take a look at the documentation. The proxy only supports curl_httpclient

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 17:14:00

    Proxies are currently only supported with curl_httpclient.

    via http://www.tornadoweb.org/en/stable/httpclient.html#tornado.httpclient.HTTPRequest

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 17:14:00

    httpclient.AsyncHTTPClient.configure(
                "tornado.curl_httpclient.CurlAsyncHTTPClient"
            )

    This document explains that only curl_httpclient supports proxy, you need to configure it like this.
    When using it, just add proxy parameters to the fetch function proxy_host="127.0.0.1", proxy_port=8787.

    reply
    0
  • Cancelreply