diff options
| author | Rapptz <[email protected]> | 2019-02-27 06:34:13 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2019-02-27 06:34:30 -0500 |
| commit | 48b60b2eac89ad5d8510b04f509390da35996492 (patch) | |
| tree | 6f870d6053a5f02a782326ad41e2eefc0d10cec7 | |
| parent | Update Member.joined_at on MESSAGE_CREATE and document it can be None. (diff) | |
| download | discord.py-48b60b2eac89ad5d8510b04f509390da35996492.tar.xz discord.py-48b60b2eac89ad5d8510b04f509390da35996492.zip | |
Prepare fix for aiohttp 4.0 breaking change with session creation.
| -rw-r--r-- | discord/http.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/discord/http.py b/discord/http.py index cde1a373..3fb13591 100644 --- a/discord/http.py +++ b/discord/http.py @@ -89,7 +89,7 @@ class HTTPClient: def __init__(self, connector=None, *, proxy=None, proxy_auth=None, loop=None): self.loop = asyncio.get_event_loop() if loop is None else loop self.connector = connector - self._session = aiohttp.ClientSession(connector=connector, loop=self.loop) + self._session = None # filled in static_login self._locks = weakref.WeakValueDictionary() self._global_over = asyncio.Event(loop=self.loop) self._global_over.set() @@ -240,6 +240,8 @@ class HTTPClient: # login management async def static_login(self, token, *, bot): + # Necessary to get aiohttp to stop complaining about session creation + self._session = aiohttp.ClientSession(connector=self.connector, loop=self.loop) old_token, old_bot = self.token, self.bot_token self._token(token, bot=bot) |