MCPcopy Index your code
hub / github.com/python/cpython / applies_to

Method applies_to

Lib/urllib/robotparser.py:268–279  ·  view source on GitHub ↗

check if this entry applies to the specified agent

(self, useragent)

Source from the content-addressed store, hash-verified

266 return '\n'.join(ret)
267
268 def applies_to(self, useragent):
269 """check if this entry applies to the specified agent"""
270 # split the name token and make it lower case
271 useragent = useragent.split("/")[0].lower()
272 for agent in self.useragents:
273 if agent == '*':
274 # we have the catch-all agent
275 return True
276 agent = agent.lower()
277 if agent in useragent:
278 return True
279 return False
280
281 def allowance(self, filename):
282 """Preconditions:

Callers 4

can_fetchMethod · 0.45
crawl_delayMethod · 0.45
request_rateMethod · 0.45
allowanceMethod · 0.45

Calls 2

lowerMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected