MCPcopy
hub / github.com/USArmyResearchLab/Dshell / check_file_dates

Method check_file_dates

dshell/dshellgeoip.py:34–43  ·  view source on GitHub ↗

Check the data file age, and log a warning if it's over a year old.

(self)

Source from the content-addressed store, hash-verified

32 self.acc = acc
33
34 def check_file_dates(self):
35 """
36 Check the data file age, and log a warning if it's over a year old.
37 """
38 cc_mtime = datetime.datetime.fromtimestamp(os.path.getmtime(self.geoccfile))
39 asn_mtime = datetime.datetime.fromtimestamp(os.path.getmtime(self.geoasnfile))
40 n = datetime.datetime.now()
41 year = datetime.timedelta(days=365)
42 if (n - cc_mtime) > year or (n - asn_mtime) > year:
43 logger.debug("GeoIP data file(s) over a year old, and possibly outdated.")
44
45 def geoip_country_lookup(self, ip):
46 """

Callers 1

mainFunction · 0.45

Calls 1

debugMethod · 0.80

Tested by

no test coverage detected