#!/usr/bin/env python3

import cgi
import json

form = cgi.FieldStorage() 
name = form.getvalue('name')

class Payload:
    def __init__(self, name):
        self.success = True if name is not None else False
        self.email = "foo@bar.glux" if self.success else ""

print("Content-type: application/json")
print("")
print(json.dumps(Payload(name).__dict__))
