Revert "Refactor Client.run to use asyncio.run"

This reverts commit 6e6c8a7b28.
This commit is contained in:
Rapptz
2021-08-11 02:16:22 -04:00
parent 6e6c8a7b28
commit 08a4db3961
2 changed files with 102 additions and 99 deletions

View File

@@ -167,7 +167,7 @@ class HTTPClient:
loop: Optional[asyncio.AbstractEventLoop] = None,
unsync_clock: bool = True
) -> None:
self.loop: asyncio.AbstractEventLoop = MISSING if loop is None else loop # filled in static_login
self.loop: asyncio.AbstractEventLoop = asyncio.get_event_loop() if loop is None else loop
self.connector = connector
self.__session: aiohttp.ClientSession = MISSING # filled in static_login
self._locks: weakref.WeakValueDictionary = weakref.WeakValueDictionary()
@@ -371,7 +371,6 @@ class HTTPClient:
async def static_login(self, token: str) -> user.User:
# Necessary to get aiohttp to stop complaining about session creation
self.loop = asyncio.get_running_loop()
self.__session = aiohttp.ClientSession(connector=self.connector, ws_response_class=DiscordClientWebSocketResponse)
old_token = self.token
self.token = token