From 76e76f2905d93d5ef16ff2c9015c7bd4918628b8 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 4 Mar 2017 23:27:57 -0500 Subject: [PATCH] Add underscore to HTTPClient.session to imply privateness. --- discord/http.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/discord/http.py b/discord/http.py index 699b2d4f5..2627d966e 100644 --- a/discord/http.py +++ b/discord/http.py @@ -90,7 +90,7 @@ class HTTPClient: def __init__(self, connector=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 = aiohttp.ClientSession(connector=connector, loop=self.loop) self._locks = weakref.WeakValueDictionary() self._global_lock = asyncio.Lock(loop=self.loop) self.token = None @@ -133,7 +133,7 @@ class HTTPClient: yield from lock with MaybeUnlock(lock) as maybe_lock: for tries in range(5): - r = yield from self.session.request(method, url, **kwargs) + r = yield from self._session.request(method, url, **kwargs) log.debug(self.REQUEST_LOG.format(method=method, url=url, status=r.status, json=kwargs.get('data'))) try: # even errors have text involved in them so this is safe to call @@ -219,10 +219,7 @@ class HTTPClient: @asyncio.coroutine def close(self): - yield from self.session.close() - - def recreate(self): - self.session = aiohttp.ClientSession(connector=self.connector, loop=self.loop) + yield from self._session.close() def _token(self, token, *, bot=True): self.token = token