我们一般是要拿url和response部分?:
drission_page_init:
[paths]
download_path =
tmp_path =
[chromium_options]
address = 127.0.0.1:9222
browser_path = C:\Users\10501\AppData\Local\Google\Chrome\Application\chrome.exe
arguments = ['--no-default-browser-check', '--disable-suggestions-ui', '--no-first-run', '--disable-infobars', '--disable-popup-blocking']
extensions = []
prefs = {'profile.default_content_settings.popups': 0, 'profile.default_content_setting_values': {'notifications': 2}}
flags = {}
load_mode = normal
user = Default
auto_port = False
system_user_path = False
existing_only = False
[session_options]
headers = {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8', 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'connection': 'keep-alive', 'accept-charset': 'GB2312,utf-8;q=0.7,*;q=0.7'}
[timeouts]
base = 10
page_load = 30
script = 30
[proxies]
http =
https =
[others]
retry_times = 3
retry_interval = 2
drissionpage_use.py:
# ---encoding:utf-8---
# @Time : 2024/1/14 07:09
# @Author : stzz Wang
# @Email :1050100468@qq.com
# @Site :
# @File : drissionpage_use.py
# @Project : PythonUtils
# @Software: PyCharm
from DrissionPage import ChromiumOptions , SessionOptions , WebPage
def drissionpage_use():
co = ChromiumOptions(ini_path="./config/drission_page_init")
so = SessionOptions(ini_path="./config/drission_page_init")
page = WebPage(chromium_options=co,session_or_options=so)
page.listen.start()
page.get("https://baidu.com")
for _ in range(50):
response = page.listen.wait()
print(response.url)
def __run_drissionpage_use__():
drissionpage_use()
if __name__ == '__main__':
__run_drissionpage_use__()
?