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

Method __init__

tornado/httpclient.py:89–110  ·  view source on GitHub ↗
(
        self,
        async_client_class: "Optional[Type[AsyncHTTPClient]]" = None,
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

87 """
88
89 def __init__(
90 self,
91 async_client_class: "Optional[Type[AsyncHTTPClient]]" = None,
92 **kwargs: Any,
93 ) -> None:
94 # Initialize self._closed at the beginning of the constructor
95 # so that an exception raised here doesn't lead to confusing
96 # failures in __del__.
97 self._closed = True
98 self._io_loop = IOLoop(make_current=False)
99 if async_client_class is None:
100 async_client_class = AsyncHTTPClient
101
102 # Create the client while our IOLoop is "current", without
103 # clobbering the thread's real current IOLoop (if any).
104 async def make_client() -> "AsyncHTTPClient":
105 await gen.sleep(0)
106 assert async_client_class is not None
107 return async_client_class(**kwargs)
108
109 self._async_client = self._io_loop.run_sync(make_client)
110 self._closed = False
111
112 def __del__(self) -> None:
113 self.close()

Callers 1

__init__Method · 0.45

Calls 2

IOLoopClass · 0.90
run_syncMethod · 0.80

Tested by

no test coverage detected