无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

【原創(chuàng)】selenium配置代理(賬密、隧道)

2023-02-27 21:47 作者:拉燈的小手  | 我要投稿

本文所有教程及源碼、軟件僅為技術研究。不涉及計算機信息系統(tǒng)功能的刪除、修改、增加、干擾,更不會影響計算機信息系統(tǒng)的正常運行。不得將代碼用于非法用途,如侵立刪!

selenium配置代理(賬密、隧道)

環(huán)境

  • win10

  • Python3.9

  • selenium3.141.0

selenium 配置demo

def create_proxy_auth_extension(proxy_host, proxy_port,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?proxy_username, proxy_password,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?scheme='http', plugin_path=None):
? ?if plugin_path is None:
? ? ? ?plugin_path = r'./proxy_auth_plugin.zip'


? ?manifest_json = """
? ? ? ?{
? ? ? ? ? ?"version": "1.0.0",
? ? ? ? ? ?"manifest_version": 2,
? ? ? ? ? ?"name": "Abuyun Proxy",
? ? ? ? ? ?"permissions": [
? ? ? ? ? ? ? ?"proxy",
? ? ? ? ? ? ? ?"tabs",
? ? ? ? ? ? ? ?"unlimitedStorage",
? ? ? ? ? ? ? ?"storage",
? ? ? ? ? ? ? ?"<all_urls>",
? ? ? ? ? ? ? ?"webRequest",
? ? ? ? ? ? ? ?"webRequestBlocking"
? ? ? ? ? ?],
? ? ? ? ? ?"background": {
? ? ? ? ? ? ? ?"scripts": ["background.js"]
? ? ? ? ? ?},
? ? ? ? ? ?"minimum_chrome_version":"22.0.0"
? ? ? ?}
? ? ? ?"""

? ?background_js = string.Template(
? ? ? ?"""
? ? ? ?var config = {
? ? ? ? ? ?mode: "fixed_servers",
? ? ? ? ? ?rules: {
? ? ? ? ? ? ? ?singleProxy: {
? ? ? ? ? ? ? ? ? ?scheme: "${scheme}",
? ? ? ? ? ? ? ? ? ?host: "${host}",
? ? ? ? ? ? ? ? ? ?port: parseInt(${port})
? ? ? ? ? ? ? ?},
? ? ? ? ? ? ? ?bypassList: ["foobar.com"]
? ? ? ? ? ?}
? ? ? ? ?};
? ?
? ? ? ?chrome.proxy.settings.set({value: config, scope: "regular"}, function() {});
? ?
? ? ? ?function callbackFn(details) {
? ? ? ? ? ?return {
? ? ? ? ? ? ? ?authCredentials: {
? ? ? ? ? ? ? ? ? ?username: "${username}",
? ? ? ? ? ? ? ? ? ?password: "${password}"
? ? ? ? ? ? ? ?}
? ? ? ? ? ?};
? ? ? ?}
? ?
? ? ? ?chrome.webRequest.onAuthRequired.addListener(
? ? ? ? ? ?callbackFn,
? ? ? ? ? ?{urls: ["<all_urls>"]},
? ? ? ? ? ?['blocking']
? ? ? ?);
? ? ? ?"""
? ?).substitute(
? ? ? ?host=proxy_host,
? ? ? ?port=proxy_port,
? ? ? ?username=proxy_username,
? ? ? ?password=proxy_password,
? ? ? ?scheme=scheme,
? ?)

? ?with zipfile.ZipFile(plugin_path, 'w') as zp:
? ? ? ?zp.writestr("manifest.json", manifest_json)
? ? ? ?zp.writestr("background.js", background_js)

? ?return plugin_path


proxy_auth_plugin_path = create_proxy_auth_extension(
? ?proxy_host=proxyHost,
? ?proxy_port=proxyPort,
? ?proxy_username=proxyUser,
? ?proxy_password=proxyPass)

option = webdriver.ChromeOptions()
option.add_extension(proxy_auth_plugin_path)

效果

二級標題

效果

請?zhí)砑訄D片描述

資源下載

https://download.csdn.net/download/qq_38154948/87511999

本文僅供學習交流使用,如侵立刪!


【原創(chuàng)】selenium配置代理(賬密、隧道)的評論 (共 條)

分享到微博請遵守國家法律
普兰县| 永寿县| 青阳县| 曲阳县| 克拉玛依市| 宜兴市| 杭州市| 五峰| 若尔盖县| 达拉特旗| 宁南县| 宜阳县| 壤塘县| 兴国县| 绥中县| 襄汾县| 湾仔区| 望奎县| 合作市| 蓬溪县| 石屏县| 肥西县| 托里县| 古丈县| 淮滨县| 文水县| 上饶县| 雅江县| 甘南县| 墨竹工卡县| 合水县| 沙坪坝区| 保亭| 新宁县| 大同县| 安顺市| 新闻| 克山县| 清水县| 宝清县| 贡嘎县|