Python 官方文档:入门教程 => 点击学习
1、独立cookie。(两个打印结果应该不同)#coding=utf-8 import grequests urls = [ 'Http://www.baidu.com/', 'http://www.zhihu.com/',
1、独立cookie。(两个打印结果应该不同)
#coding=utf-8
import grequests
urls = [
'Http://www.baidu.com/',
'http://www.zhihu.com/',
]
rs = [grequests.get(url) for url in urls]
grequests.map(rs)
for ar in rs:
print(ar.session.cookies)
2、共享cookie。(三个打印结果应该相同)
#coding=utf-8
import grequests
import requests
urls = [
'http://www.baidu.com/',
'http://www.zhihu.com/',
]
sn = requests.Session()
rs = [grequests.get(url, session = sn) for url in urls]
grequests.map(rs)
for ar in rs:
print(ar.session.cookies)
print(sn.cookies)
相关阅读:grequests pypi
*** walker ***
--结束END--
本文标题: 关于grequests的session/
本文链接: https://lsjlt.com/news/190545.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0