本文来自网易云社区

作者:王涛

        :arg str url: URL to fetch
        :arg str method: HTTP method, e.g. "GET" or "POST"
        :arg headers: Additional HTTP headers to pass on the request
        :type headers: `~tornado.httputil.HTTPHeaders` or `dict`
        :arg body: HTTP request body as a string (byte or unicode; if unicode
           the utf-8 encoding will be used)
        :arg body_producer: Callable used for lazy/asynchronous request bodies.
           It is called with one argument, a ``write`` function, and should
           return a `.Future`.  It should call the write function with new           data as it becomes available.  The write function returns a           `.Future` which can be used for flow control.           Only one of ``body`` and ``body_producer`` may
           be specified.  ``body_producer`` is not supported on
           ``curl_httpclient``.  When using ``body_producer`` it is recommended           to pass a ``Content-Length`` in the headers as otherwise chunked
           encoding will be used, and many servers do not support chunked
           encoding on requests.  New in Tornado 4.0
        :arg str auth_username: Username for HTTP authentication
        :arg str auth_password: Password for HTTP authentication
        :arg str auth_mode: Authentication mode; default is "basic".
           Allowed values are implementation-defined; ``curl_httpclient``
           supports "basic" and "digest"; ``simple_httpclient`` only supports
           "basic"
        :arg float connect_timeout: Timeout for initial connection in seconds,
           default 20 seconds
        :arg float request_timeout: Timeout for entire request in seconds,
           default 20 seconds
        :arg if_modified_since: Timestamp for ``If-Modified-Since`` header
        :type if_modified_since: `datetime` or `float`
        :arg bool follow_redirects: Should redirects be followed automatically
           or return the 3xx response? Default True.
        :arg int max_redirects: Limit for ``follow_redirects``, default 5.
        :arg str user_agent: String to send as ``User-Agent`` header
        :arg bool decompress_response: Request a compressed response from
           the server and decompress it after downloading.  Default is True.
           New in Tornado 4.0.
        :arg bool use_gzip: Deprecated alias for ``decompress_response``
           since Tornado 4.0.
        :arg str network_interface: Network interface to use for request.           ``curl_httpclient`` only; see note below.
        :arg collections.abc.Callable streaming_callback: If set, ``streaming_callback`` will
           be run with each chunk of data as it is received, and
           ``HTTPResponse.body`` and ``HTTPResponse.buffer`` will be empty in
           the final response.
        :arg collections.abc.Callable header_callback: If set, ``header_callback`` will
           be run with each header line as it is received (including the           first line, e.g. ``HTTP/1.0 200 OK\r\n``, and a final line
           containing only ``\r\n``.  All lines include the trailing newline
           characters).  ``HTTPResponse.headers`` will be empty in the final
           response.  This is most useful in conjunction with
           ``streaming_callback``, because it's the only way to get access to
           header data while the request is in progress.
        :arg collections.abc.Callable prepare_curl_callback: If set, will be called with
           a ``pycurl.Curl`` object to allow the application to make additional
           ``setopt`` calls.
        :arg str proxy_host: HTTP proxy hostname.  To use proxies,
           ``proxy_host`` and ``proxy_port`` must be set; ``proxy_username``,
           ``proxy_pass`` and ``proxy_auth_mode`` are optional.  Proxies are
           currently only supported with ``curl_httpclient``.
        :arg int proxy_port: HTTP proxy port
        :arg str proxy_username: HTTP proxy username
        :arg str proxy_password: HTTP proxy password
        :arg str proxy_auth_mode: HTTP proxy Authentication mode;
           default is "basic". supports "basic" and "digest"
        :arg bool allow_nonstandard_methods: Allow unknown values for ``method``
           argument? Default is False.
        :arg bool validate_cert: For HTTPS requests, validate the server's
           certificate? Default is True.
        :arg str ca_certs: filename of CA certificates in PEM format,           or None to use defaults.  See note below when used with
           ``curl_httpclient``.
        :arg str client_key: Filename for client SSL key, if any.  See
           note below when used with ``curl_httpclient``.
        :arg str client_cert: Filename for client SSL certificate, if any.
           See note below when used with ``curl_httpclient``.
        :arg ssl.SSLContext ssl_options: `ssl.SSLContext` object for use in
           ``simple_httpclient`` (unsupported by ``curl_httpclient``).
           Overrides ``validate_cert``, ``ca_certs``, ``client_key``,           and ``client_cert``.
        :arg bool allow_ipv6: Use IPv6 when available?  Default is true.
        :arg bool expect_100_continue: If true, send the           ``Expect: 100-continue`` header and wait for a continue response           before sending the request body.  Only supported with
           simple_httpclient.         .. note::            When using ``curl_httpclient`` certain options may be
            inherited by subsequent fetches because ``pycurl`` does            not allow them to be cleanly reset.  This applies to the            ``ca_certs``, ``client_key``, ``client_cert``, and
            ``network_interface`` arguments.  If you use these
            options, you should pass them on every request (you don't
            have to always use the same values, but it's not possible            to mix requests that specify these options with ones that            use the defaults).         .. versionadded:: 3.1
           The ``auth_mode`` argument.         .. versionadded:: 4.0
           The ``body_producer`` and ``expect_100_continue`` arguments.         .. versionadded:: 4.2
           The ``ssl_options`` argument.         .. versionadded:: 4.5
           The ``proxy_auth_mode`` argument.        """
        # Note that some of these attributes go through property setters
        # defined below.
        ...

参数说明如下:

<td style="border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-to

相关文章:
【推荐】 从风控的角度解析如何防止客户刷单

爬虫开发python工具包介绍 (3)的更多相关文章

  1. 爬虫开发python工具包介绍 (1)

    本文来自网易云社区 作者:王涛 本文大纲: 简易介绍今天要讲解的两个爬虫开发的python库 详细介绍 requests库及函数中的各个参数 详细介绍 tornado 中的httpcilent的应用 ...

  2. 爬虫开发python工具包介绍 (2)

    本文来自网易云社区 作者:王涛 可选参数我们一一介绍一下: 参数 释义 示例 params 生成url中?号后面的查询Key=value 示例1: >>>payload = {'ke ...

  3. 爬虫开发python工具包介绍 (4)

    本文来自网易云社区 作者:王涛 此处我们给出几个常用的代码例子,包括get,post(json,表单),带证书访问:Get 请求 @gen.coroutine def fetch_url():     ...

  4. Python爬虫开发与项目实战

    Python爬虫开发与项目实战(高清版)PDF 百度网盘 链接:https://pan.baidu.com/s/1MFexF6S4No_FtC5U2GCKqQ 提取码:gtz1 复制这段内容后打开百度 ...

  5. Python 3网络爬虫开发实战》中文PDF+源代码+书籍软件包

    Python 3网络爬虫开发实战>中文PDF+源代码+书籍软件包 下载:正在上传请稍后... 本书书籍软件包为本人原创,在这个时间就是金钱的时代,有些软件下起来是很麻烦的,真的可以为你们节省很多 ...

  6. Python 3网络爬虫开发实战中文 书籍软件包(原创)

    Python 3网络爬虫开发实战中文 书籍软件包(原创) 本书书籍软件包为本人原创,想学爬虫的朋友你们的福利来了.软件包包含了该书籍所需的所有软件. 因为软件导致这个文件比较大,所以百度网盘没有加速的 ...

  7. Python 3网络爬虫开发实战中文PDF+源代码+书籍软件包(免费赠送)+崔庆才

    Python 3网络爬虫开发实战中文PDF+源代码+书籍软件包+崔庆才 下载: 链接:https://pan.baidu.com/s/1H-VrvrT7wE9-CW2Dy2p0qA 提取码:35go ...

  8. 《Python 3网络爬虫开发实战中文》超清PDF+源代码+书籍软件包

    <Python 3网络爬虫开发实战中文>PDF+源代码+书籍软件包 下载: 链接:https://pan.baidu.com/s/18yqCr7i9x_vTazuMPzL23Q 提取码:i ...

  9. Python 3网络爬虫开发实战书籍

    Python 3网络爬虫开发实战书籍,教你学会如何用Python 3开发爬虫   本书介绍了如何利用Python 3开发网络爬虫,书中首先介绍了环境配置和基础知识,然后讨论了urllib.reques ...

随机推荐

  1. PHP 函数的参数

    函数的参数 通过参数列表可以传递信息到函数,即以逗号作为分隔符的表达式列表. PHP 支持按值传递参数(默认),通过引用传递参数以及默认参数.也支持可变数量的参数:更多信息请参照可变长度参数列表和涉及 ...

  2. JS中对数组元素进行增删改移

    在js中对数组元素进行增删改移,简单总结了一下方法: 方法 说明 实例 push( ); 在原来数组中的元素最后面添加元素 arr.push("再见58"); unshift( ) ...

  3. linux winqq 不能输入中文的解决办法

    wineqq的运行脚本是/usr/share/deepinwine/qqintl/wine-qqintl编辑此脚本,在最开始加入: export XMODIFIERS="@im=fcitx& ...

  4. H5移动端图片裁剪(base64)

    在移动端开发的过程中,或许会遇到对图片裁剪的问题.当然遇到问题问题,不管你想什么方法都是要进行解决的,哪怕是丑点,难看点,都得去解决掉. 图片裁剪的jquery插件有很多,我也测试过很多,不过大多数都 ...

  5. POJ 2486 Apple Tree (树形DP,树形背包)

    题意:给定一棵树图,一个人从点s出发,只能走K步,每个点都有一定数量的苹果,要求收集尽量多的苹果,输出最多苹果数. 思路: 既然是树,而且有限制k步,那么树形DP正好. 考虑1个点的情况:(1)可能在 ...

  6. (二)maven之项目结构

    我们可以看一下Maven项目的大致结构:      项目结构: src/main/java:java源代码文件目录. src/main/resources:资源库,会自动赋值到classes目录里,像 ...

  7. Python数据结构和类型--解压序列赋值多个变量

    Python数据结构和类型 1.1 解压序列赋值给多个变量 现在有一个包含N个元素的元组或者是序列,怎样将它里面的值解压后同时赋值给N个变量? 解决思路:先通过简单的解压赋值给多个变量,前提是变量的数 ...

  8. 基于Passthru的NDIS开发的个人理解

    这几天对NDIS的学习,基本思路是:首先熟悉理论知识→然后下载一个例子进行研究→最后例子自己模仿扩展→最最后尝试自己写一个新的. Passthru是微软NDIS自己写的一个框架驱动,NDIS开发者可以 ...

  9. Luogu P4231 三步必杀 (差分)

    目录 题目 题解 题目 题目链接 题目背景 (三)旧都 离开狭窄的洞穴,眼前豁然开朗. 天空飘着不寻常的雪花. 一反之前的幽闭,现在面对的,是繁华的街市,可以听见酒碗碰撞的声音. 这是由被人们厌恶的鬼 ...

  10. 初涉平衡树「treap」

    treap:一种平衡的二叉搜索树 什么是treap(带旋) treap=tree+heap,这大家都知道.因为二叉搜索树(BST)非常容易被卡成一条链而影响效率,所以我们需要一种更加平衡的树形结构,从 ...

参数 释义
url 目标url
method http方法,例:get,post等
headers 自定义http头,字典或tornado.httputil.HTTPHeaders 类型,
body http请求体,类型字符串或者unicode(unicode,需要在头中指定unicode)
auth_username HTTP认证用户名
auth_password HTTP认证,密码
auth_mode 认证模式:默认basic,CurlAsyncHTTPClient支持 basic,digest, SimpleAsyncHTTPClien 支持 basic.
connect_timeout 连接超时时长,默认20s
request_timeout 连接成功后,完整的请求时长,默认20s
if_modified_since Http头中的 If-modified-since字段类型datetime or float
follow_redirects 是进行跳转还是返回3xx的应答,默认True,会跳转
max_redirects 最大的跳转次数,默认 5次
user_agent UA
decompress_response 要求服务端返回一个压缩过的应答,下载完成后会执行解压缩
use_gzip 已经废弃了
network_interface 指定网络出接口,只有CurlAsyncHTTPClient 有效
streaming_callback 如果设置了,接收的每个数据块都会调用这个callback.
最后的应答中HTTPResponse.body 和 HTTPResponse.buffer 都是空的。
类型:collections.abc.Callable
header_callback 会遍历header中的每一行,和streaming_callback一起用,因为这是在请求处理过程中唯一访问header数据的方式
类型:collections.abc.Callable
proxy_host 代理主机名,仅 CurlAsyncHTTPClient支持 ,类型:字符串
proxy_port 代理主机端口号,类型:整型
proxy_username 代理认证用户名,根据实际情况填写,类型:字符串
proxy_password 代理认证密码,根据实际情况填写,类型:字符串
proxy_auth_mode 代理认证模式,支持basic,digest 类型:字符串,默认 basic
validate_cert 是否需要验证服务端证书,类型:bool 默认:True
一条不起眼的分割线
body_producer 可以被用于延迟/异步请求体调用. 它可以被调用, 带有一个参数, 一个 write 函数, 并应该 返回一个 Future 对象. 它应该在新的数据可用时调用 write 函数. write 函数返回一个可用于流程控制的 Future 对象. 只能指定 body 和 body_producer 其中之一. body_producer 不被 curl_httpclient 支持. 当使用 body_producer 时, 建议传递一个 Content-Length 头, 否则将使用其他的分块编码, 并且很多服务断不支持请求的分块编码. Tornado 4.0 新增
prepare_curl_callback 如果设置, 将使用 pycurl.Curl 对象调用, 以允许应用程序进行额外的 setopt 调用。没有用过
allow_nonstandard_methods 支持未知的http方法,默认False
ca_certs PEM格式的证书路径或者None.
注:因为Pycurl的原因,不能将指定此选项的请求与使用默认值的请求混用
client_key 客户端ssl key文件名