def save_datafile(self, data, timestamp, pathname=None):
    subpath = os.path.join(data['meta']['domain_name'])
    if (pathname is not None):
        subpath = os.path.join(pathname, data['meta']['domain_name'])
    if (not os.path.isdir(subpath)):
        os.mkdir(subpath)
    md5prefix = hashlib.md5(data['meta']['reference'].encode('utf-8')).hexdigest()[0:4]
    filename = os.path.join(subpath, '{}_{}_{}.json'.format(data['meta']['host_name'], md5prefix, timestamp))
    with open(filename, 'w') as f:
        f.write(json_dumps(data, indent='  '))
    logger.info('Phish data written to {}'.format(filename))
def save_datafile(self, data, timestamp, pathname=None):
    subpath = os.path.join(data['meta']['domain_name'])
    if (pathname is not None):
        subpath = os.path.join(pathname, data['meta']['domain_name'])
    if (not os.path.isdir(subpath)):
        os.mkdir(subpath)
    md5prefix = hashlib.md5(data['meta']['reference'].encode('utf-8')).hexdigest()[0:4]
    filename = os.path.join(subpath, '{}_{}_{}.json'.format(data['meta']['host_name'], md5prefix, timestamp))
    with open(filename, 'w') as f:
        f.write(json_dumps(data, indent='  '))
    logger.info('Phish data written to {}'.format(filename))