Forums

Add discord api to white list!

I use discord.py and this error happened:

The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/Fab4key/main.py", line 448, in <module>
    client.run(TOKEN)
  File "/home/Fab4key/.local/lib/python3.9/site-packages/discord/client.py", line 723, in run
    return future.result()
    proto = await self._create_connection(req, traces, timeout)
  File "/home/Fab4key/.local/lib/python3.9/site-packages/discord/client.py", line 702, in runner
    await self.start(*args, **kwargs)
  File "/home/Fab4key/.local/lib/python3.9/site-packages/discord/client.py", line 665, in start
    await self.login(*args, bot=bot)
  File "/home/Fab4key/.local/lib/python3.9/site-packages/discord/client.py", line 511, in login
    await self.http.static_login(token.strip(), bot=bot)
  File "/home/Fab4key/.local/lib/python3.9/site-packages/discord/http.py", line 300, in static_login
    data = await self.request(Route('GET', '/users/@me'))
  File "/home/Fab4key/.local/lib/python3.9/site-packages/discord/http.py", line 192, in request
    async with self.__session.request(method, url, **kwargs) as r:
  File "/home/Fab4key/.local/lib/python3.9/site-packages/aiohttp/client.py", line 1117, in __aenter__
    self._resp = await self._coro
  File "/home/Fab4key/.local/lib/python3.9/site-packages/aiohttp/client.py", line 520, in _request
    conn = await self._connector.connect(
  File "/home/Fab4key/.local/lib/python3.9/site-packages/aiohttp/connector.py", line 535, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/home/Fab4key/.local/lib/python3.9/site-packages/aiohttp/connector.py", line 892, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/home/Fab4key/.local/lib/python3.9/site-packages/aiohttp/connector.py", line 1051, in _create_direct_connection
    raise last_exc
  File "/home/Fab4key/.local/lib/python3.9/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/home/Fab4key/.local/lib/python3.9/site-packages/aiohttp/connector.py", line 975, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host discord.com:443 ssl:default [Connect call failed ('1
62.159.135.232', 443)]

[formatted by admin]

We have several discord endpoints whitelisted. Check if discord.py handles the proxy correctly -- we have a help page on that: https://help.pythonanywhere.com/pages/403ForbiddenError/