MCPcopy Index your code
hub / github.com/grapeot/devin.cursorrules / fetch_page

Function fetch_page

tools/web_scraper.py:23–37  ·  view source on GitHub ↗

Asynchronously fetch a webpage's content.

(url: str, context)

Source from the content-addressed store, hash-verified

21logger = logging.getLogger(__name__)
22
23async def fetch_page(url: str, context) -> Optional[str]:
24 """Asynchronously fetch a webpage's content."""
25 page = await context.new_page()
26 try:
27 logger.info(f"Fetching {url}")
28 await page.goto(url)
29 await page.wait_for_load_state('networkidle')
30 content = await page.content()
31 logger.info(f"Successfully fetched {url}")
32 return content
33 except Exception as e:
34 logger.error(f"Error fetching {url}: {str(e)}")
35 return None
36 finally:
37 await page.close()
38
39def parse_html(html_content: Optional[str]) -> str:
40 """Parse HTML content and extract text with hyperlinks in markdown format."""

Callers 2

test_fetch_pageMethod · 0.90
process_urlsFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_fetch_pageMethod · 0.72