Merge PR #1281: Fix proxy auth ERR_INVALID_AUTH_CREDENTIALS
This commit is contained in:
@@ -728,7 +728,7 @@ class BrowserConfig:
|
|||||||
chrome_channel=kwargs.get("chrome_channel", "chromium"),
|
chrome_channel=kwargs.get("chrome_channel", "chromium"),
|
||||||
channel=kwargs.get("channel", "chromium"),
|
channel=kwargs.get("channel", "chromium"),
|
||||||
proxy=kwargs.get("proxy"),
|
proxy=kwargs.get("proxy"),
|
||||||
proxy_config=kwargs.get("proxy_config", None),
|
proxy_config=ProxyConfig.from_dict(kwargs.get("proxy_config")) if isinstance(kwargs.get("proxy_config"), dict) else kwargs.get("proxy_config", None),
|
||||||
viewport_width=kwargs.get("viewport_width", 1080),
|
viewport_width=kwargs.get("viewport_width", 1080),
|
||||||
viewport_height=kwargs.get("viewport_height", 600),
|
viewport_height=kwargs.get("viewport_height", 600),
|
||||||
accept_downloads=kwargs.get("accept_downloads", False),
|
accept_downloads=kwargs.get("accept_downloads", False),
|
||||||
@@ -770,7 +770,7 @@ class BrowserConfig:
|
|||||||
"chrome_channel": self.chrome_channel,
|
"chrome_channel": self.chrome_channel,
|
||||||
"channel": self.channel,
|
"channel": self.channel,
|
||||||
"proxy": self.proxy,
|
"proxy": self.proxy,
|
||||||
"proxy_config": self.proxy_config.to_dict() if self.proxy_config else None,
|
"proxy_config": self.proxy_config.to_dict() if hasattr(self.proxy_config, 'to_dict') else self.proxy_config,
|
||||||
"viewport_width": self.viewport_width,
|
"viewport_width": self.viewport_width,
|
||||||
"viewport_height": self.viewport_height,
|
"viewport_height": self.viewport_height,
|
||||||
"accept_downloads": self.accept_downloads,
|
"accept_downloads": self.accept_downloads,
|
||||||
@@ -1788,7 +1788,7 @@ class CrawlerRunConfig():
|
|||||||
prettiify=kwargs.get("prettiify", False),
|
prettiify=kwargs.get("prettiify", False),
|
||||||
parser_type=kwargs.get("parser_type", "lxml"),
|
parser_type=kwargs.get("parser_type", "lxml"),
|
||||||
scraping_strategy=kwargs.get("scraping_strategy"),
|
scraping_strategy=kwargs.get("scraping_strategy"),
|
||||||
proxy_config=kwargs.get("proxy_config"),
|
proxy_config=ProxyConfig.from_dict(kwargs.get("proxy_config")) if isinstance(kwargs.get("proxy_config"), dict) else kwargs.get("proxy_config"),
|
||||||
proxy_rotation_strategy=kwargs.get("proxy_rotation_strategy"),
|
proxy_rotation_strategy=kwargs.get("proxy_rotation_strategy"),
|
||||||
# Sticky Proxy Session Parameters
|
# Sticky Proxy Session Parameters
|
||||||
proxy_session_id=kwargs.get("proxy_session_id"),
|
proxy_session_id=kwargs.get("proxy_session_id"),
|
||||||
@@ -1918,7 +1918,7 @@ class CrawlerRunConfig():
|
|||||||
"prettiify": self.prettiify,
|
"prettiify": self.prettiify,
|
||||||
"parser_type": self.parser_type,
|
"parser_type": self.parser_type,
|
||||||
"scraping_strategy": self.scraping_strategy,
|
"scraping_strategy": self.scraping_strategy,
|
||||||
"proxy_config": self.proxy_config,
|
"proxy_config": self.proxy_config.to_dict() if hasattr(self.proxy_config, 'to_dict') else self.proxy_config,
|
||||||
"proxy_rotation_strategy": self.proxy_rotation_strategy,
|
"proxy_rotation_strategy": self.proxy_rotation_strategy,
|
||||||
"proxy_session_id": self.proxy_session_id,
|
"proxy_session_id": self.proxy_session_id,
|
||||||
"proxy_session_ttl": self.proxy_session_ttl,
|
"proxy_session_ttl": self.proxy_session_ttl,
|
||||||
|
|||||||
@@ -1202,14 +1202,12 @@ class BrowserManager:
|
|||||||
if crawlerRunConfig:
|
if crawlerRunConfig:
|
||||||
# Check if there is value for crawlerRunConfig.proxy_config set add that to context
|
# Check if there is value for crawlerRunConfig.proxy_config set add that to context
|
||||||
if crawlerRunConfig.proxy_config:
|
if crawlerRunConfig.proxy_config:
|
||||||
proxy_settings = {
|
from playwright.async_api import ProxySettings
|
||||||
"server": crawlerRunConfig.proxy_config.server,
|
proxy_settings = ProxySettings(
|
||||||
}
|
server=crawlerRunConfig.proxy_config.server,
|
||||||
if crawlerRunConfig.proxy_config.username:
|
username=crawlerRunConfig.proxy_config.username,
|
||||||
proxy_settings.update({
|
password=crawlerRunConfig.proxy_config.password,
|
||||||
"username": crawlerRunConfig.proxy_config.username,
|
)
|
||||||
"password": crawlerRunConfig.proxy_config.password,
|
|
||||||
})
|
|
||||||
context_settings["proxy"] = proxy_settings
|
context_settings["proxy"] = proxy_settings
|
||||||
|
|
||||||
if self.config.text_mode:
|
if self.config.text_mode:
|
||||||
|
|||||||
Reference in New Issue
Block a user