Diff for /comics/status_scan.py between versions 1.1 and 1.2

version 1.1, 2018/02/06 14:59:10 version 1.2, 2018/02/12 13:30:58
Line 1 Line 1
 #!/usr/bin/python  #!/usr/bin/python
 # -*- coding: utf-8 -*-  # -*- coding: utf-8 -*-
   
   import datetime
 import json  import json
 import smtplib  import smtplib
 import socket  import socket
Line 25  def generateMessageBody(report): Line 26  def generateMessageBody(report):
     for error in report['comics']:      for error in report['comics']:
         if error['error']:          if error['error']:
             body += '  %-25s%s\n' % (error['comicName'], error['error'])              body += '  %-25s%s\n' % (error['comicName'], error['error'])
   
       if report.get('errorMessage'):
           body += '\nAdditional Error Message:\n\t' + report['errorMessage']
     return body      return body
   
   
Line 37  def notifyErrors(report): Line 41  def notifyErrors(report):
   
 def fetchStatusReport(source):  def fetchStatusReport(source):
     response = urllib.urlopen(source)      response = urllib.urlopen(source)
     return json.loads(response.read())      results = json.loads(response.read())
       now = datetime.datetime.now()
       shortDate = "%d%02d%02d" % (now.year, now.month, now.day)
       if results['date'] != shortDate:
           results['errorMessage'] = "Error: Comics not ran today!"
           notifyErrors(results)
           exit(2)
       return results
   
   
 def main():  def main():

Removed from v.1.1  
changed lines
  Added in v.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>