mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-06-23 21:00:30 +08:00
fix(proxy-rotation): removed max_shape duplicate
This commit is contained in:
parent
1e9a564616
commit
5d6d996e8f
@ -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)
|
||||
@ -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
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -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}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user