requests
weixin_43639743
这个作者很懒,什么都没留下…
展开
-
python aiohttp asyncio 协程发起请求
使用协程发起请求,速度会快很多,我增加了重试机制,自定义并发数,接收响应内容。原创 2024-04-12 10:53:25 · 109 阅读 · 0 评论 -
python 将字典转成url参数
from urllib.parse import urlencodeparams = {‘wd’: ‘python’, ‘ie’: ‘utf-8’}result = urlencode(params) # wd=python&ie=utf-8将url参数转成字典from urllib.parse import parse_qs, urlparseurl = ‘https://www.baidu.com/s?&wd=python&ie=utf-8’提取url参数query转载 2021-11-18 14:44:34 · 1381 阅读 · 0 评论 -
python 爬虫 解析页面的编码问题
根据requests请求回来的页面进行解码,直接调用即可; def code_conversion(self,response): ''' 解决requests的编码问题 :param response: requests库请求过来的响应体 :return: ''' html = response.content htmltxt = '' encode_type =原创 2020-09-02 19:22:11 · 314 阅读 · 0 评论