forked from sanbornm/Site-Monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
smstat.py
30 lines (24 loc) · 923 Bytes
/
smstat.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python
# This is an incomplete implementation of smstat.py. It exists to test and detail
# the addition of meta-data pickling in sitemonitor.py.
# - dontpanic ([email protected])
import pickle, os, sys, pprint
#from optparse import OptionParser, OptionValueError
def load_old_results(file_path):
'''Attempts to load most recent results'''
pickledata = {}
if os.path.isfile(file_path):
picklefile = open(file_path, 'rb')
pickledata = pickle.load(picklefile)
picklefile.close()
return pickledata
def main():
print '(Incomplete) Site Monitor Stat\n'
pickledata = load_old_results('data.pkl')
printer = pprint.PrettyPrinter(indent=4)
# This is all we are gonna do for now, soon this script will
# take command-line options to determine what and how to print
print 'Un-pickled metadata:'
printer.pprint(pickledata);
if __name__ == '__main__':
main()