searches for a proxy server matching the specified broker criteria Args: proxy: The proxy configuration to search for. Returns: A 'playwright' compliant proxy configuration.
(proxy: Proxy)
| 161 | |
| 162 | |
| 163 | def _search_proxy(proxy: Proxy) -> ProxySettings: |
| 164 | """searches for a proxy server matching the specified broker criteria |
| 165 | |
| 166 | Args: |
| 167 | proxy: The proxy configuration to search for. |
| 168 | |
| 169 | Returns: |
| 170 | A 'playwright' compliant proxy configuration. |
| 171 | """ |
| 172 | |
| 173 | # remove max_shape from criteria |
| 174 | criteria = proxy.get("criteria", {}).copy() |
| 175 | criteria.pop("max_shape", None) |
| 176 | |
| 177 | server = search_proxy_servers(max_shape=1, **criteria)[0] |
| 178 | |
| 179 | return {"server": server} |
| 180 | |
| 181 | |
| 182 | def is_ipv4_address(address: str) -> bool: |