zoukankan      html  css  js  c++  java
  • python库--requests

    requests

    方法 返回 参数 方法详情
    .get()  r  url  get请求
    params  url?后面的内容会以'key=value'的方式接到url后面
    proxies 设置代理ip, {'http':'ip:端口'}
    headers 请求消息头'User-Agent':浏览器信息
    timeout 超时设置
    r.status_code int   响应状态吗
    r.encoding str   解码方式, 默认自动推断, 可赋值更改
    r.raw urllib.response 使用r.raw.read()读取
    r.content     字节方式的响应体,会自动为你解码 gzip 和 deflate 压缩
    r.text     字符串方式的响应体,会自动根据响应头部的字符编码进行解码
    r.headers     以字典对象存储服务器响应头,但是这个字典比较特殊,字典键不区分大小写,若键不存在则返回None
    r.json()     requests中内置json解码器
    r.raise_for_ststus()     失败请求(非200响应)抛出异常
  • 相关阅读:
    hdu4291 A Short problem
    UVA
    HDU
    Be Geeks!
    HDU
    hdu6559 The Tower
    胜利大逃亡(续) + Maze
    Stealing Harry Potter's Precious
    hdu5172 GTY's gay friends
    Log Concave Sequences Gym
  • 原文地址:https://www.cnblogs.com/P--K/p/7904332.html
Copyright © 2011-2022 走看看