五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(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配置代理(賬密、隧道)的評論 (共 條)

分享到微博請遵守國家法律
盐亭县| 萍乡市| 涟源市| 天祝| 同江市| 陵川县| 新兴县| 海南省| 军事| 夏河县| 醴陵市| 丹凤县| 华容县| 阿城市| 博野县| 荣昌县| 桐城市| 札达县| 邳州市| 镇巴县| 当涂县| 花莲市| 秭归县| 香河县| 治县。| 仙游县| 同仁县| 平潭县| 龙陵县| 札达县| 临潭县| 青海省| 麟游县| 清水县| 甘德县| 鄄城县| 广饶县| 张掖市| 韩城市| 安龙县| 东明县|