fix(proxy-rotation): removed max_shape duplicate

This commit is contained in:
Marco Perini 2024-05-13 07:26:43 +02:00
parent 1e9a564616
commit 5d6d996e8f
3 changed files with 10 additions and 15 deletions

View File

@ -1,11 +0,0 @@
from scrapegraphai.utils import search_proxy_servers
proxies = search_proxy_servers(
anonymous=True,
countryset={"IT"},
# secure=True,
timeout=1.0,
max_shape=2
)
print(proxies)

View File

@ -28,10 +28,10 @@ graph_config = {
"server": "broker",
"criteria": {
"anonymous": True,
# "secure": True,
"secure": True,
"countryset": {"IT"},
"timeout": 5.0,
"max_shape": 2
"timeout": 10.0,
"max_shape": 3
},
},
}

View File

@ -161,7 +161,13 @@ def _search_proxy(proxy: Proxy) -> ProxySettings:
Returns:
A 'playwright' compliant proxy configuration.
"""
server = search_proxy_servers(**proxy.get("criteria", {}))[0]
# remove max_shape from criteria
criteria = proxy.get("criteria", {}).copy()
criteria.pop("max_shape", None)
server = search_proxy_servers(max_shape=1, **criteria)[0]
return {"server": server}