def gen_secret(self): # Running this invalidates the cert self.cert = None self.server["secret"] = gen_secret()