Destroys this HTTP client, freeing any file descriptors used. This method is **not needed in normal use** due to the way that `AsyncHTTPClient` objects are transparently reused. ``close()`` is generally only necessary when either the `.IOLoop` is also being closed, o
(self)
| 221 | self._closed = False |
| 222 | |
| 223 | def close(self) -> None: |
| 224 | """Destroys this HTTP client, freeing any file descriptors used. |
| 225 | |
| 226 | This method is **not needed in normal use** due to the way |
| 227 | that `AsyncHTTPClient` objects are transparently reused. |
| 228 | ``close()`` is generally only necessary when either the |
| 229 | `.IOLoop` is also being closed, or the ``force_instance=True`` |
| 230 | argument was used when creating the `AsyncHTTPClient`. |
| 231 | |
| 232 | No other methods may be called on the `AsyncHTTPClient` after |
| 233 | ``close()``. |
| 234 | |
| 235 | """ |
| 236 | if self._closed: |
| 237 | return |
| 238 | self._closed = True |
| 239 | if self._instance_cache is not None: |
| 240 | cached_val = self._instance_cache.pop(self.io_loop, None) |
| 241 | # If there's an object other than self in the instance |
| 242 | # cache for our IOLoop, something has gotten mixed up. A |
| 243 | # value of None appears to be possible when this is called |
| 244 | # from a destructor (HTTPClient.__del__) as the weakref |
| 245 | # gets cleared before the destructor runs. |
| 246 | if cached_val is not None and cached_val is not self: |
| 247 | raise RuntimeError("inconsistent AsyncHTTPClient cache") |
| 248 | |
| 249 | def fetch( |
| 250 | self, |