Put result in variable in twilio.rest

So, i have this code:

import os
from twilio.rest import Client

    <Say language="ru-RU">Здравствуйте, пожалуйста введите код для подтверждения.</Say>
account_sid = ('AC274461ad47988c753424a3c8735dbcc1')
auth_token =('8ac88e8d5bce419ae3b5cbac4fc255f9')
client = Client(account_sid, auth_token)

call = client.calls.create(                                       twiml=xml,


I want to put in xml, that way, so i could put result of (what user typed in) in variable. I want to do it only with python and twilio.rest, on twilio site i only found how to do it with flask, url and twiml.


Twilio developer evangelist here.

In order to be able to run interactive phone calls, there needs to be a way for your application to give instructions to Twilio, receive responses and then give further instructions. The instructions are the TwiML that you send to Twilio, but the way that Twilio communicates things back to you, like the result of what a user typed during a <Gather>, is via webhooks. Webhooks are HTTP requests from Twilio that include data about the call, like user input, in the body of the request.

To use that data and provide Twilio with further TwiML instructions your application needs to be able to receive HTTP requests and respond with an HTTP response containing the TwiML.

There are example in the Twilio documentation using Flask because Flask is a good way to receive and respond to HTTP requests in Python. You could build an application without a framework like Flask, but you would still need to be able to receive an incoming HTTP request and respond to it.