Format proxy configuration into a string. Args: proxy_config: Proxy configuration as string, dict, or ProxyConfig Returns: str: Formatted proxy string
(proxy_config: Union[str, Dict, ProxyConfig])
| 417 | |
| 418 | |
| 419 | def format_proxy(proxy_config: Union[str, Dict, ProxyConfig]) -> str: |
| 420 | """ |
| 421 | Format proxy configuration into a string. |
| 422 | |
| 423 | Args: |
| 424 | proxy_config: Proxy configuration as string, dict, or ProxyConfig |
| 425 | |
| 426 | Returns: |
| 427 | str: Formatted proxy string |
| 428 | """ |
| 429 | if isinstance(proxy_config, str): |
| 430 | return proxy_config |
| 431 | |
| 432 | if isinstance(proxy_config, dict): |
| 433 | proxy_config = ProxyConfig(**proxy_config) |
| 434 | |
| 435 | # Format proxy with authentication if provided |
| 436 | if proxy_config.username and proxy_config.password: |
| 437 | auth = f"{proxy_config.username}:{proxy_config.password}@" |
| 438 | return f"http://{auth}{proxy_config.server}" |
| 439 | |
| 440 | return f"http://{proxy_config.server}" |
| 441 | |
| 442 | |
| 443 | def filter_pdf_links(urls: List[str]) -> List[str]: |
no test coverage detected