Last active
September 6, 2019 19:32
-
-
Save lbolla/501ebba48f343dc530fb5e88af97c3f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run the server with: | |
# $> newrelic-admin run-python newrelic-tornado6.py --logging=debug | |
# Hit the server with: | |
# $> curl http://localhost:8888/ | |
# Note the error in the server logs | |
import tornado.httpclient | |
import tornado.ioloop | |
from tornado.options import parse_command_line | |
import tornado.web | |
# URL that returns a redirect code, e.g. 302 | |
url = "http://httpbin.org/redirect-to?url=http%3A%2F%2Fwww.google.com&status_code=302" | |
class MainHandler(tornado.web.RequestHandler): | |
async def get(self): | |
c = tornado.httpclient.AsyncHTTPClient() | |
r = await c.fetch(url) | |
self.write(r.body) | |
if __name__ == "__main__": | |
parse_command_line() | |
application = tornado.web.Application([ | |
(r"/", MainHandler), | |
], debug=True) | |
application.listen(8888) | |
tornado.ioloop.IOLoop.current().start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Snippet to reproduce https://support.newrelic.com/tickets/367805/edit