@jsonwrap
    def render_POST(self, request):
        send_cors(request)
        #err = require_args(request, ('sid', 'client_secret', 'mxid'))
        err = require_args(request, ('sid', 'mxid'))
        if err:
            return err

        sid = request.args['sid'][0]
        mxid = request.args['mxid'][0]
        if 'client_secret' in request.args:
            clientSecret = request.args['client_secret'][0]
        elif 'clientSecret' in request.args:
            clientSecret = request.args['clientSecret'][0]
        else:
            request.setResponseCode(400)
            return {'errcode': 'M_MISSING_PARAM', 'error':'No client_secret'}

        # Return the same error for not found / bad client secret otherwise people can get information about
        # sessions without knowing the secret
        noMatchError = {'errcode': 'M_NO_VALID_SESSION',
                        'error': "No valid session was found matching that sid and client secret"}

        try:
            res = self.sydent.threepidBinder.addBinding(sid, clientSecret, mxid)
            return res
        except IncorrectClientSecretException:
            return noMatchError
        except SessionExpiredException:
            return {'errcode': 'M_SESSION_EXPIRED',
                    'error': "This validation session has expired: call requestToken again"}
        except InvalidSessionIdException:
            return noMatchError
        except SessionNotValidatedException:
            return {'errcode': 'M_SESSION_NOT_VALIDATED',
                    'error': "This validation session has not yet been completed"}
dataset/ETHPy150Open matrix-org/sydent/sydent/http/servlets/threepidbindservlet.py/ThreePidBindServlet.render_POST/original