Skip to content

[Errno 101] Cannot connect to host brawlapi.cf:443 #19

@milan252525

Description

@milan252525

Describe the bug

Traceback (most recent call last):
  File "lib/aiohttp/connector.py", line 601, in _create_direct_connection
    local_addr=self._local_addr)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 695, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.5/asyncio/base_events.py", line 682, in create_connection
    yield from self.sock_connect(sock, address)
  File "/usr/lib/python3.5/asyncio/selector_events.py", line 402, in sock_connect
    return (yield from fut)
  File "/usr/lib/python3.5/asyncio/futures.py", line 363, in __iter__
    return self.result()  # May raise too.
  File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/usr/lib/python3.5/asyncio/selector_events.py", line 407, in _sock_connect
    sock.connect(address)
OSError: [Errno 101] Network is unreachable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "lib/aiohttp/connector.py", line 304, in connect
    yield from self._create_connection(req)
  File "lib/aiohttp/connector.py", line 578, in _create_connection
    transport, proto = yield from self._create_direct_connection(req)
  File "lib/aiohttp/connector.py", line 624, in _create_direct_connection
    (req.host, req.port, exc.strerror)) from exc
aiohttp.errors.ClientOSError: [Errno 101] Can not connect to brawlapi.cf:443 [Network is unreachable]

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "lib/discord/ext/commands/core.py", line 50, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "/home/newbot/labot/Red-DiscordBot/cogs/labs.py", line 25, in club
    club1 = await self.bs.get_club("V9GRP2C")
  File "/home/newbot/.local/lib/python3.5/site-packages/brawlstats/core.py", line 96, in _aget_model
    data, resp = await self._arequest(url)
  File "/home/newbot/.local/lib/python3.5/site-packages/brawlstats/core.py", line 83, in _arequest
    async with self.session.get(url, timeout=self.timeout, headers=self.headers) as resp:
  File "lib/aiohttp/client.py", line 565, in __aenter__
    self._resp = yield from self._coro
  File "lib/aiohttp/client.py", line 198, in _request
    conn = yield from self._connector.connect(req)
  File "lib/aiohttp/connector.py", line 314, in connect
    .format(key, exc.strerror)) from exc
aiohttp.errors.ClientOSError: [Errno 101] Cannot connect to host brawlapi.cf:443 ssl:True [Can not connect to brawlapi.cf:443 [Network is unreachable]]

Full Code

import discord
from discord.ext import commands
from .utils import checks 
import brawlstats
import asyncio

class LABS:
    def __init__(self, bot):
        self.bot = bot
        self.bs = brawlstats.Client('token', is_async=True)
    @commands.command(pass_context = True)
    async def club(self, ctx):
        club = await self.bs.get_club("VP2RL8P")
        embed = discord.Embed(description = club.description, colour = discord.Colour.blue())
        embed.set_author(name = club.name, icon_url = club.badge_url)
        embed.add_field(name = "Status", value = club.status)
        embed.add_field(name = "Members", value = str(club.members_count) + "/100")
        embed.add_field(name = "Status", value = club.status)
        await self.bot.say(embed = embed)
def setup(bot):
    bot.add_cog(LABS(bot))

Expected behavior
Connect to the API and retrieve data

Actual behavior
Can't connect, sync client works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions