MCPcopy Create free account
hub / github.com/apify/crawlee-python / find

Method find

src/crawlee/_utils/robots.py:75–84  ·  view source on GitHub ↗

Determine the location of a robots.txt file for a URL and fetch it. Args: url: The URL whose domain will be used to find the corresponding robots.txt file. http_client: Optional `ProxyInfo` to be used when fetching the robots.txt file. If None, no proxy is used.

(cls, url: str, http_client: HttpClient, proxy_info: ProxyInfo | None = None)

Source from the content-addressed store, hash-verified

73
74 @classmethod
75 async def find(cls, url: str, http_client: HttpClient, proxy_info: ProxyInfo | None = None) -> Self:
76 """Determine the location of a robots.txt file for a URL and fetch it.
77
78 Args:
79 url: The URL whose domain will be used to find the corresponding robots.txt file.
80 http_client: Optional `ProxyInfo` to be used when fetching the robots.txt file. If None, no proxy is used.
81 proxy_info: The `HttpClient` instance used to perform the network request for fetching the robots.txt file.
82 """
83 robots_url = URL(url).with_path('/robots.txt')
84 return await cls.load(str(robots_url), http_client, proxy_info)
85
86 def is_allowed(self, url: str, user_agent: str = '*') -> bool:
87 """Check if the given URL is allowed for the given user agent.

Callers 15

_fnmatch_translateFunction · 0.80
_discover_for_hostnameFunction · 0.80
default_handlerFunction · 0.80
default_handlerFunction · 0.80
_reduce_headMethod · 0.80
default_handlerFunction · 0.80
configureWebpackFunction · 0.80

Calls 1

loadMethod · 0.45

Tested by 3