Requests 取消警告方法&Response返回值Unicode转utf-8

一.取消警告方法

1.放在py文件最上面如图

import warnings
warnings.filterwarnings("ignore")

二. requests 可以传的参数

1.session = HTMLSession()
2.session = Session()
response = session.get(url, params=params, headers=headers, proxies=proxies, verify=False,timeout=5)
response = requests.post(url, params=params, headers=headers, proxies=proxies, verify=False,timeout=5)

三. Response 返回值 Unicode 转 utf-8

result = response.content.decode("gbk")
result = price_response.content.decode("utf-8"))
result = response.encode('utf-8').decode('unicode_escape')
posted @ 2020-03-20 11:22  莫贞俊晗  阅读(852)  评论(0编辑  收藏  举报