Python 如何爬取获取需要登录页面的网页信息-简易版

环境

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的查看地址:

Python 如何爬取获取需要登录页面的网页信息-简易版_第1张图片

 

你可能感兴趣的:(Python,爬虫)