From 2a9ab69f4b4c64f13c23c121be2d46643b6414bc Mon Sep 17 00:00:00 2001 From: Kshitij Jande Date: Thu, 13 Jun 2024 12:18:41 +0530 Subject: [PATCH] Strip out the scheme from the server address URI --- scrapegraphai/utils/proxy_rotation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scrapegraphai/utils/proxy_rotation.py b/scrapegraphai/utils/proxy_rotation.py index 9938f168..07e04d0f 100644 --- a/scrapegraphai/utils/proxy_rotation.py +++ b/scrapegraphai/utils/proxy_rotation.py @@ -4,6 +4,7 @@ import ipaddress import random +import re from typing import List, Optional, Set, TypedDict import requests @@ -230,7 +231,7 @@ def parse_or_search_proxy(proxy: Proxy) -> ProxySettings: """ assert "server" in proxy, "missing server in the proxy configuration" - server_address = proxy["server"].split(":", maxsplit=1)[0] + server_address = re.sub(r'^\w+://', '', proxy["server"]).split(":", maxsplit=1)[0] if is_ipv4_address(server_address): return _parse_proxy(proxy)