From a741d7922c4a6ed9dff594f286fbe2b203a9ff2a Mon Sep 17 00:00:00 2001 From: calvin Date: Wed, 17 May 2006 15:35:48 +0000 Subject: [PATCH] add get_crawldelay method git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3226 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- linkcheck/robotparser2.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/linkcheck/robotparser2.py b/linkcheck/robotparser2.py index 0410a2fe..e5d4e636 100755 --- a/linkcheck/robotparser2.py +++ b/linkcheck/robotparser2.py @@ -357,6 +357,18 @@ class RobotFileParser (object): # agent not found ==> access granted return True + def get_crawldelay (self, useragent): + """ + Look for a configured crawl delay. + + @return: crawl delay in seconds or zero + @rtype: integer >= 0 + """ + for entry in self.entries: + if entry.applies_to(useragent): + return entry.crawldelay + return 0 + def __str__ (self): """ Constructs string representation, usable as contents of a