mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-23 01:10:27 +00:00
cleanup
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1173 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
17d79f45f3
commit
ed563ee2e6
2 changed files with 13 additions and 12 deletions
|
|
@ -18,11 +18,6 @@
|
|||
|
||||
import sys, re, urlparse, urllib2, time, traceback, socket, select, i18n
|
||||
from urllib import splituser, splitport, unquote
|
||||
#try:
|
||||
# from linkcheck import DNS
|
||||
#except ImportError:
|
||||
# print >>sys.stderr, "You have to install PyDNS from http://pydns.sf.net/"
|
||||
# raise SystemExit
|
||||
from linkcheck import DNS, LinkCheckerError, getLinkPat
|
||||
DNS.DiscoverNameServers()
|
||||
|
||||
|
|
@ -379,7 +374,8 @@ class UrlData (object):
|
|||
# check recursion
|
||||
debug(BRING_IT_ON, "checking recursion")
|
||||
if self.allowsRecursion():
|
||||
try: self.parseUrl()
|
||||
try:
|
||||
self.parseUrl()
|
||||
except tuple(ExcList):
|
||||
value, tb = sys.exc_info()[1:]
|
||||
debug(HURT_ME_PLENTY, "exception", traceback.format_tb(tb))
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ extensions = {
|
|||
|
||||
import UrlData
|
||||
from debug import *
|
||||
from linkcheck.log import strduration
|
||||
|
||||
# main check function
|
||||
def checkUrls (config):
|
||||
|
|
@ -57,7 +58,6 @@ def checkUrls (config):
|
|||
to check it (checkUrl).
|
||||
"""
|
||||
config.log_init()
|
||||
from linkcheck.log import strduration
|
||||
try:
|
||||
start_time = time.time()
|
||||
status_time = start_time
|
||||
|
|
@ -70,12 +70,8 @@ def checkUrls (config):
|
|||
time.sleep(0.1)
|
||||
if config['status']:
|
||||
curtime = time.time()
|
||||
tocheck = config.urls.qsize()
|
||||
active = config.threader.active_threads()
|
||||
links = config['linknumber']
|
||||
duration = strduration(curtime - start_time)
|
||||
if (curtime - status_time) > 5:
|
||||
print >>sys.stderr, i18n._("%5d urls queued, %4d links checked, %2d active threads, runtime %s")%(tocheck, links, active, duration)
|
||||
printStatus(config, curtime, start_time)
|
||||
status_time = curtime
|
||||
config.log_endOfOutput()
|
||||
except KeyboardInterrupt:
|
||||
|
|
@ -84,3 +80,12 @@ def checkUrls (config):
|
|||
active = config.threader.active_threads()
|
||||
warn(i18n._("keyboard interrupt; waiting for %d active threads to finish") % active)
|
||||
raise
|
||||
|
||||
|
||||
def printStatus (config, curtime, start_time):
|
||||
tocheck = config.urls.qsize()
|
||||
links = config['linknumber']
|
||||
active = config.threader.active_threads()
|
||||
duration = strduration(curtime - start_time)
|
||||
print >>sys.stderr, i18n._("%5d urls queued, %4d links checked, %2d active threads, runtime %s")%\
|
||||
(tocheck, links, active, duration)
|
||||
|
|
|
|||
Loading…
Reference in a new issue