python爬虫模拟登陆

2023-05-12,,

python爬虫模拟登陆

学习了:https://www.cnblogs.com/chenxiaohan/p/7654667.html  用的这个

学习了:https://www.cnblogs.com/stuqx/p/7253321.html  参考这个

学习了:https://blog.csdn.net/m_wbcg/article/details/70243372

学习了:https://www.cnblogs.com/whatbeg/p/5320666.html

python3的requests库:

headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'Accept-Encoding': 'gzip, deflate',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Cache-Control': 'max-age=0',
'Connection': 'keep-alive',
'Host': 'a.b.com.cn',
'Upgrade-Insecure-Requests': '1',
'User-Agent': 'aaa'}
cookie_str = bbbb=false; crowd.token_key=a; seraph.confluence=e%b; JSESSIONID=c'
cookies = {}
for line in cookie_str.split(';'):
key, value = line.split('=', 1)
cookies[key] = value
keyword = {"aaa": 333}
for id01 in ids:
response01 = requests.get(url, params=keyword, headers=headers, cookies=cookies)
text = response01.text
f01 = open(id01 + ".html", "w")
f01.write(text)
break

python爬虫模拟登陆的相关教程结束。

《python爬虫模拟登陆.doc》

下载本文的Word格式文档,以方便收藏与打印。