The literal equivalent is
python -m tornado.httpclient 'http://localhost:2222/foo?bar=1'
Or in a coroutine
print (yield AsyncHTTPClient().fetch('http://localhost:2222/foo?bar=1')).body
Frage
Can I use the Tornado facilities to write HTTP client queries? As opposed to using the http.client module in the standard library.
What would be the equivalent Tornado code for:
curl 'http://localhost:2222/foo?bar=1'
Lösung
The literal equivalent is
python -m tornado.httpclient 'http://localhost:2222/foo?bar=1'
Or in a coroutine
print (yield AsyncHTTPClient().fetch('http://localhost:2222/foo?bar=1')).body