responder icon indicating copy to clipboard operation
responder copied to clipboard

Simple test with api.requests take 20-30 seconds

Open tomaratyn opened this issue 5 years ago • 2 comments

Following the test instructions on https://python-responder.org/en/latest/testing.html#building-and-testing-with-responder, the test takes 20-30 seconds.

If you don't provide a domain name, Responder's version Requests makes the hostname ; and then tries to resolve it. Since that's (hopefully!) not a real host, it fails to resolve and the developer has to wait for a timeout.

tomaratyn avatar Sep 09 '19 17:09 tomaratyn

The problem is with the ; here: https://github.com/taoufik07/responder/blob/master/responder/api.py#L317

tomaratyn avatar Sep 09 '19 17:09 tomaratyn

One workaround is to explicitly overwrite the base_url:

api.session().base_url = "http://example"

Since the session is reused for each instance of api, this should work around the problem.

tomaratyn avatar Sep 09 '19 17:09 tomaratyn