def _call_httpie_main(self):
context = self._final_context()
args = extract_args_for_httpie_main(context, self.method)
env = Environment(stdout=self.output, stdin=sys.stdin,
is_windows=False)
env.stdout_isatty = self.output.isatty()
env.stdin_isatty = sys.stdin.isatty()
# XXX: httpie_main() doesn't provide an API for us to get the
# HTTP response object, so we use this super dirty hack -
# sys.settrace() to intercept get_response() that is called in
# httpie_main() internally. The HTTP response intercepted is
# assigned to self.last_response, which self.listener may be
# interested in.
sys.settrace(self._trace_get_response)
try:
httpie_main(args, env=env)
finally:
sys.settrace(None)
评论列表
文章目录