Issue
i need to retrive twilio SMS StatusCallback json, but i have problem to take all values in a single json from twilio.
i follow this example https://www.twilio.com/docs/sms/tutorials/how-to-confirm-delivery-python?code-sample=code-handle-a-sms-statuscallback-1&code-language=Python&code-sdk-version=6.x
i try to improve with request.get_json() but i recive None values. it's work if i specify with value with requests.values.get
@app.route("/MessageStatus", methods=['POST'])
def incoming_sms():
message_sid = request.values.get('MessageSid', None)
message_status = request.values.get('MessageStatus', None)
logging.info('SID: {}, Status: {}'.format(message_sid, message_status))
print(request.get_json())
return ('', 204)
thank you a lot!
Solution
print(json.dumps(request.values.to_dict()))
Answered By - Smart Manoj
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.