当前位置 : 主页 > 网页制作 > HTTP/TCP >

requests请求

来源:互联网 收集:自由互联 发布时间:2021-06-16
requests:伪造浏览器请求请求 1 .get requests.get( url = ‘‘ , params = { ‘ k1 ‘ : ‘‘ v1, ‘ k2 ‘ : ‘ v2 ‘ } ) 即 url?k1 =k2k2= v2 2 .post requests.post( url = ‘‘ , # data 提交的数据 data= {key: value},
requests:伪造浏览器请求
请求
    1.get
        requests.get(
            url=‘‘,
            params={
                k1: ‘‘v1,
                k2: v2
            }
        )
        即 url?k1=k2&k2=v2
    2.post
        requests.post(
            url=‘‘,
            # data 提交的数据
            data={key: value},
            # 请求头
            headeres={},
            # cookies值需要从get请求中获取
            cookies= ,
        )
    3.other
        requests.get(url, params=None, **kwargs)
        requests.post(url, data=None, json=None, **kwargs)
        requests.put(url, data=None, **kwargs)
        requests.head(url, **kwargs)
        requests.delete(url, **kwargs)
        requests.patch(url, data=None, **kwargs)
        requests.options(url, **kwargs)
网友评论