mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-26 09:04:44 +00:00
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@78 e7d03fd6-7b0d-0410-9947-9c21f3af8025
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
"""__init__.py in linkcheck
|
|
|
|
Here we find the main function to call: checkUrls.
|
|
This is the only entry point into the linkcheck module and is used
|
|
of course by the linkchecker script.
|
|
"""
|
|
|
|
# i18n suppport
|
|
try:
|
|
import fintl
|
|
gettext = fintl.gettext
|
|
fintl.bindtextdomain('linkcheck')
|
|
fintl.textdomain('linkcheck')
|
|
except ImportError:
|
|
def gettext(msg):
|
|
return msg
|
|
import Config,UrlData,OutputReader,sys,lc_cgi
|
|
|
|
def checkUrls(config = Config.Configuration()):
|
|
""" checkUrls gets a complete configuration object as parameter where all
|
|
runtime-dependent options are stored.
|
|
If you call checkUrls more than once, you can specify different
|
|
configurations.
|
|
|
|
In the config object there are functions to get a new URL (getUrl) and
|
|
to check it (checkUrl).
|
|
"""
|
|
config.log_init()
|
|
try:
|
|
while not config.finished():
|
|
if config.hasMoreUrls():
|
|
config.checkUrl(config.getUrl())
|
|
except KeyboardInterrupt:
|
|
config.finish()
|
|
config.log_endOfOutput()
|
|
sys.exit(1) # XXX this is not good(tm)
|
|
config.log_endOfOutput()
|