MCPcopy
hub / github.com/unclecode/crawl4ai / test_custom_user_agent

Function test_custom_user_agent

tests/async/test_crawler_strategy.py:14–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12
13@pytest.mark.asyncio
14async def test_custom_user_agent():
15 async with AsyncWebCrawler(verbose=True) as crawler:
16 custom_user_agent = "MyCustomUserAgent/1.0"
17 crawler.crawler_strategy.update_user_agent(custom_user_agent)
18 url = "https://httpbin.org/user-agent"
19 result = await crawler.arun(url=url, bypass_cache=True)
20 assert result.success
21 assert custom_user_agent in result.html
22
23@pytest.mark.asyncio
24async def test_custom_headers():

Callers

nothing calls this directly

Calls 3

AsyncWebCrawlerClass · 0.90
arunMethod · 0.80
update_user_agentMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…