Ejemplo n.º 1
0
def generate_hash(filename):
    if not os.path.isfile(filename):
        print filename, "must be a valid file"
        return None
    with open(filename, 'r') as f:
        contents = f.read()
    entries = TextFormatter.get_entries(contents)
    return {e[KEY_PARAM]: e for e in entries}
Ejemplo n.º 2
0
def generate_hash(filename):
    if not os.path.isfile(filename):
        print filename, "must be a valid file"
        return None
    with open(filename, 'r') as f:
        contents = f.read()
    entries = TextFormatter.get_entries(contents)
    return {e[KEY_PARAM]: e for e in entries}
Ejemplo n.º 3
0
from emailer.config import ConfigGenerator, ConfigKeys

if len(sys.argv) < 2:
    print "Usage: python send.py [data_folder]"
    exit(1)

folder_name = sys.argv[1]
if not os.path.isdir(folder_name):
    print folder_name, "is not a valid folder"
    exit(1)

config = ConfigGenerator(folder_name)
sender = EmailSender(config.get(ConfigKeys.SMTP_EMAIL),
                     config.get(ConfigKeys.EMAIL_DRY_RUNS_TO),
                     config.get(ConfigKeys.EMAIL_BASE_CC))
formatter = TextFormatter(config)

errors = False
if formatter.missing_resources:
    errors = True
    print "Could not find the following resources:", ", ".join(formatter.missing_resources)

if formatter.missing_tsv_keys:
    errors = True
    print "Tsv file must have the following fields:", ", ".join(formatter.missing_tsv_keys)

if errors:
    exit(1)

is_html = formatter.is_html
entries = formatter.entries