Python 如何爬取获取需要登录页面的网页信息-简易版
程序员文章站
2023-12-31 22:40:34
环境1.pycharm2.python3.7参考代码如下:from urllib import requesturl = 'https://rm.qkmtech.com/projects/qkmp923/roadmap/'headers ={ 'user-Agent': 'Mozilla/5.0(Windows NT 10.0;WOW64)AppleWebKit/537.36(KHTML, likeGecko)Chrome/78.0.3904.108Safari/5...
环境
1.pycharm
2.python3.7
参考代码如下:
from urllib import request
url = 'https://rm.qkmtech.com/projects/qkmp923/roadmap/'
headers ={
'user-Agent': 'Mozilla/5.0(Windows NT 10.0;WOW64)AppleWebKit/537.36(KHTML, likeGecko)Chrome/78.0.3904.108Safari/537.36',
'Cookie':'XXXX'
}
req = request.Request(url,headers = headers)
respose = request.urlopen(req)
print(respose.read().decode())
对于cookie的查看地址:
本文地址:https://blog.csdn.net/u014157897/article/details/107301735