Is there a way in tornado framework to setup callbacks synchronously.
For eg
print word
self.twitter_request(path= "/search",
access_token=self.current_user["access_token"],
callback=self.test,q=word,rpp="100")
And my test function is defined as
def test(self,response):
print "Test"
In the above request, I have a set of 2 words which is being queried against the twitter api. However, the above request functions synchronously.
I get output as
Query1
Query2
Test
Test
However I want to output as
Query1
Test
Query2
Test
Any ideas how to tweak the above code to achieve what I am intending to do?
If your goal is to have a list of queries executed in order, then you could use the
@gen.engineapproach to doing your handler ( http://www.tornadoweb.org/documentation/gen.html ). Then you would structure your code something like this: