From 1193a7f22ca2bb06eb6b474791c48cace5d61c97 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Thu, 18 Aug 2022 09:46:28 +0200 Subject: [PATCH] Playwright - Support proxy auth mechanisms (#859) --- changedetectionio/content_fetcher.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/changedetectionio/content_fetcher.py b/changedetectionio/content_fetcher.py index 49baf72f..d831ce84 100644 --- a/changedetectionio/content_fetcher.py +++ b/changedetectionio/content_fetcher.py @@ -293,7 +293,15 @@ class base_html_playwright(Fetcher): # allow per-watch proxy selection override if proxy_override: - self.proxy = {'server': proxy_override} + # https://playwright.dev/docs/network#http-proxy + from urllib.parse import urlparse + parsed = urlparse(proxy_override) + proxy_url = "{}://{}:{}".format(parsed.scheme, parsed.hostname, parsed.port) + self.proxy = {'server': proxy_url} + if parsed.username: + self.proxy['username'] = parsed.username + if parsed.password: + self.proxy['password'] = parsed.password def run(self, url,