Return a proxy URL string based on the configured proxy rotation strategy. Args: session_id: Session identifier. If provided, same proxy URL will be returned for subsequent calls with this ID. Will be auto-generated for tiered proxies if not provi
(
self, session_id: str | None = None, request: Request | None = None, proxy_tier: int | None = None
)
| 157 | return info |
| 158 | |
| 159 | async def new_url( |
| 160 | self, session_id: str | None = None, request: Request | None = None, proxy_tier: int | None = None |
| 161 | ) -> str | None: |
| 162 | """Return a proxy URL string based on the configured proxy rotation strategy. |
| 163 | |
| 164 | Args: |
| 165 | session_id: Session identifier. If provided, same proxy URL will be returned for |
| 166 | subsequent calls with this ID. Will be auto-generated for tiered proxies if |
| 167 | not provided. |
| 168 | request: Request object used for proxy rotation and tier selection. Required for |
| 169 | tiered proxies to track retries and adjust tier accordingly. |
| 170 | proxy_tier: Specific proxy tier to use. If not provided, will be automatically |
| 171 | selected based on configuration. |
| 172 | """ |
| 173 | proxy_info = await self.new_proxy_info(session_id, request, proxy_tier) |
| 174 | return proxy_info.url if proxy_info else None |
| 175 | |
| 176 | async def _pick_url( |
| 177 | self, session_id: str | None, request: Request | None, proxy_tier: int | None |