mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-15 01:53:09 +00:00
add callback after robots.txt parse
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3225 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
2aed0f3bc5
commit
fb319b3785
1 changed files with 3 additions and 1 deletions
4
linkcheck/cache/robots_txt.py
vendored
4
linkcheck/cache/robots_txt.py
vendored
|
|
@ -37,7 +37,7 @@ class RobotsTxt (object):
|
|||
self.cache = {}
|
||||
|
||||
@synchronized(_lock)
|
||||
def allows_url (self, roboturl, url, user, password):
|
||||
def allows_url (self, roboturl, url, user, password, callback=None):
|
||||
"""
|
||||
Ask robots.txt allowance.
|
||||
"""
|
||||
|
|
@ -46,6 +46,8 @@ class RobotsTxt (object):
|
|||
user=user, password=password)
|
||||
rp.set_url(roboturl)
|
||||
rp.read()
|
||||
if callback is not None:
|
||||
callback(rp)
|
||||
self.cache[roboturl] = rp
|
||||
else:
|
||||
rp = self.cache[roboturl]
|
||||
|
|
|
|||
Loading…
Reference in a new issue