Create Kibana visulaization on the fly using python script

"because it is not accepting the variable which I am trying to pass." - by this I mean if the variable "post" reads the user input say "apache logs for March" and I am passing it in SearchSourceJSON's query it should execute the query based on the input, a user has given to the "post" variable but it is not working in that way.
Yes, the object will be stored in the .kibana index and I can find it inside the saved objects even if it is failing. The error occurs at SearchSourceJSON part.