1.0?
This commit is contained in:
parent
a8c16323ac
commit
3638f91be4
@ -100,12 +100,12 @@ class Website(object):
|
|||||||
return self.url.geturl()
|
return self.url.geturl()
|
||||||
def check(self):
|
def check(self):
|
||||||
if self.r.status_code is not 200:
|
if self.r.status_code is not 200:
|
||||||
raise ReachabilityProblem
|
raise ReachabilityProblem("can't access: '%s'" % self.urlstring())
|
||||||
if self.is_tls():
|
if self.is_tls():
|
||||||
self._get_cert()
|
self._get_cert()
|
||||||
if self.cert.expiresSoon() or not self.cert.validTime():
|
if self.cert.expiresSoon() or not self.cert.validTime():
|
||||||
raise CertificateProblem(
|
raise CertificateProblem(
|
||||||
"cert for %s expires soon: %s" % (
|
"cert for %s is invalid or expires soon: %s" % (
|
||||||
self.urlstring(),
|
self.urlstring(),
|
||||||
self.cert.notAfter()
|
self.cert.notAfter()
|
||||||
)
|
)
|
||||||
@ -128,12 +128,13 @@ class Website(object):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print("usage: %s <url>" % sys.argv[0])
|
print("usage: %s <url> [url2] [url3] [...]" % sys.argv[0])
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
s = Website(sys.argv[1])
|
for site in sys.argv[1:]:
|
||||||
s.check()
|
s = Website(site)
|
||||||
for rurl in s.resources():
|
s.check()
|
||||||
Website(rurl).check()
|
for u in s.resources():
|
||||||
|
Website(u).check()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user