一、requests的相关属性
import requests
r = requests.get('https://blog.youkuaiyun.com/weixin_41542593',auth=('user', 'pass'))
# HTTP请求的返回状态,200表示成功,404表示失败
r.status_code
# 输出
200
# HTTP heading中猜测的响应内容编码方式
r.encoding
# 输出
'utf-8'
# 响应内容的编码方式
r.apparent_encoding
# 输出
'utf-8'
# HTTP响应内容的字符串形式,url对应的页面内容
r.text
# 输出
'<!DOCTYPE html>\n<html lang="zh-CN">\n<head>\n <meta charset="UTF-8">\n <link rel="canonical" href="https://blog.youkuaiyun.com/grace666/article/details/90481970"/>\n <meta http-equiv="content-type" content="text/html......
二、发送请求
# 使用requests发送网络请求
r = requests.post('https://blog.youkuaiyun.com/weixin_41542593',data={'key':'value'})
r = requests.put