mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-27 16:25:14 +02:00
ensure url is string type in robot_parser.can_fetch()
This commit is contained in:
@@ -93,7 +93,7 @@ async def check_may_autonomously_fetch_url(url: AnyUrl | str, user_agent: str) -
|
|||||||
line for line in robot_txt.splitlines() if not line.strip().startswith("#")
|
line for line in robot_txt.splitlines() if not line.strip().startswith("#")
|
||||||
)
|
)
|
||||||
robot_parser = Protego.parse(processed_robot_txt)
|
robot_parser = Protego.parse(processed_robot_txt)
|
||||||
if not robot_parser.can_fetch(url, user_agent):
|
if not robot_parser.can_fetch(str(url), user_agent):
|
||||||
raise McpError(
|
raise McpError(
|
||||||
INTERNAL_ERROR,
|
INTERNAL_ERROR,
|
||||||
f"The sites robots.txt ({robot_txt_url}), specifies that autonomous fetching of this page is not allowed, "
|
f"The sites robots.txt ({robot_txt_url}), specifies that autonomous fetching of this page is not allowed, "
|
||||||
|
|||||||
Reference in New Issue
Block a user