old_contents: #!/usr/bin/env python
  # -*- coding: UTF-8 -*-
  
  import cgi
  import cgitb
  import io
  import json
  import os
  import random
  import string
  import sys
  import time
  import urllib2
  from datetime import datetime, timedelta
  
  import fbsettings
  from fogbugz import FogBugz
  
  fb = FogBugz(fbsettings.URL, fbsettings.TOKEN)
  resp = fb.search(q='project:inbox area:* status:active due:today orderby:due',cols="dtDue,sTitle,sStatus")
  
  myList = [];
  
  for case in resp.cases:
  	date = datetime.strptime(case.dtdue.string, '%Y-%m-%dT%H:%M:%SZ').strftime('%m/%d/%Y')
  	time = str(case.dtdue.string[11:16])
  	departure = case.stitle.string.encode('UTF-8').replace('\"', '')
  	if int((datetime.strptime(case.dtdue.string, '%Y-%m-%dT%H:%M:%SZ') - datetime.now()).days) < 0:
  		status = 3
  	else:
  		status = 2
  	track =  random.randrange(0,100)
  	myList.append({'sDate': date ,'sTime':time,'sDeparture':departure,'nStatus': 2,'nTrack':track, 'bLight':False})
  
  #turn on the top light
  try:
  	myList[0]['bLight'] = True;
  except:
  	pass
  
  print "Content-Type: application/json"
  print
  print json.dumps(myList)
  
new_contents: #!/usr/bin/env python
  # -*- coding: UTF-8 -*-
  
  import json
  import random
  import time
  from datetime import datetime
  
  import fbsettings
  from fogbugz import FogBugz
  
  fb = FogBugz(fbsettings.URL, fbsettings.TOKEN)
  resp = fb.search(q='project:inbox area:* status:active due:today orderby:due',cols="dtDue,sTitle,sStatus")
  
  myList = [];
  
  for case in resp.cases:
  	date = datetime.strptime(case.dtdue.string, '%Y-%m-%dT%H:%M:%SZ').strftime('%m/%d/%Y')
  	time = str(case.dtdue.string[11:16])
  	departure = case.stitle.string.encode('UTF-8').replace('\"', '')
  	if int((datetime.strptime(case.dtdue.string, '%Y-%m-%dT%H:%M:%SZ') - datetime.now()).days) < 0:
  		status = 3
  	else:
  		status = 2
  	track =  random.randrange(0,100)
  	myList.append({'sDate': date ,'sTime':time,'sDeparture':departure,'nStatus': 2,'nTrack':track, 'bLight':False})
  
  #turn on the top light
  try:
  	myList[0]['bLight'] = True;
  except:
  	pass
  
  print "Content-Type: application/json"
  print
  print json.dumps(myList)
  
subject: remove unused imports