MCPcopy Create free account
hub / github.com/ScrapeGraphAI/Scrapegraph-ai / format_proxy

Function format_proxy

scrapegraphai/utils/research_web.py:419–440  ·  view source on GitHub ↗

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])

Source from the content-addressed store, hash-verified

417
418
419def 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
443def filter_pdf_links(urls: List[str]) -> List[str]:

Callers 1

search_on_webFunction · 0.85

Calls 1

ProxyConfigClass · 0.85

Tested by

no test coverage detected