MCPcopy
hub / github.com/tornadoweb/tornado / main

Function main

tornado/httpclient.py:757–786  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

755
756
757def main() -> None:
758 from tornado.options import define, options, parse_command_line
759
760 define("print_headers", type=bool, default=False)
761 define("print_body", type=bool, default=True)
762 define("follow_redirects", type=bool, default=True)
763 define("validate_cert", type=bool, default=True)
764 define("proxy_host", type=str)
765 define("proxy_port", type=int)
766 args = parse_command_line()
767 client = HTTPClient()
768 for arg in args:
769 try:
770 response = client.fetch(
771 arg,
772 follow_redirects=options.follow_redirects,
773 validate_cert=options.validate_cert,
774 proxy_host=options.proxy_host,
775 proxy_port=options.proxy_port,
776 )
777 except HTTPError as e:
778 if e.response is not None:
779 response = e.response
780 else:
781 raise
782 if options.print_headers:
783 print(response.headers)
784 if options.print_body:
785 print(native_str(response.body))
786 client.close()
787
788
789if __name__ == "__main__":

Callers 3

curl_httpclient.pyFile · 0.90
httpclient.pyFile · 0.70

Calls 5

fetchMethod · 0.95
closeMethod · 0.95
defineFunction · 0.90
parse_command_lineFunction · 0.90
HTTPClientClass · 0.85

Tested by

no test coverage detected