MCPcopy
hub / github.com/encode/httpx / __aenter__

Method __aenter__

httpx/_client.py:1990–2006  ·  view source on GitHub ↗
(self: U)

Source from the content-addressed store, hash-verified

1988 await proxy.aclose()
1989
1990 async def __aenter__(self: U) -> U:
1991 if self._state != ClientState.UNOPENED:
1992 msg = {
1993 ClientState.OPENED: "Cannot open a client instance more than once.",
1994 ClientState.CLOSED: (
1995 "Cannot reopen a client instance, once it has been closed."
1996 ),
1997 }[self._state]
1998 raise RuntimeError(msg)
1999
2000 self._state = ClientState.OPENED
2001
2002 await self._transport.__aenter__()
2003 for proxy in self._mounts.values():
2004 if proxy is not None:
2005 await proxy.__aenter__()
2006 return self
2007
2008 async def __aexit__(
2009 self,

Callers

nothing calls this directly

Calls 1

valuesMethod · 0.45

Tested by

no test coverage detected