Skip to content

Commit

Permalink
fix(proxy-rotation): removed max_shape duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
PeriniM committed May 13, 2024
1 parent 1e9a564 commit 5d6d996
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
11 changes: 0 additions & 11 deletions examples/openai/proxy.py

This file was deleted.

6 changes: 3 additions & 3 deletions examples/openai/smart_scraper_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"server": "broker",
"criteria": {
"anonymous": True,
# "secure": True,
"secure": True,
"countryset": {"IT"},
"timeout": 5.0,
"max_shape": 2
"timeout": 10.0,
"max_shape": 3
},
},
}
Expand Down
8 changes: 7 additions & 1 deletion scrapegraphai/utils/proxy_rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down

0 comments on commit 5d6d996

Please sign in to comment.