Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to connect #9

Closed
LaughOutQuiet opened this issue Apr 10, 2018 · 6 comments
Closed

Failed to connect #9

LaughOutQuiet opened this issue Apr 10, 2018 · 6 comments
Assignees
Labels

Comments

@LaughOutQuiet
Copy link

Traceback (most recent call last):
  File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 50, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "C:\Users\Matthew\Desktop\Projects\Python\Discord\Bots\Series\Laugh (All in one)\CogStats.py", line 66, in r6
    player = await auth.get_player(user, api.Platforms.UPLAY)
  File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\r6sapi\r6sapi.py", line 522, in get_player
    results = yield from self.get_players(name=name, platform=platform, uid=uid)
  File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\r6sapi\r6sapi.py", line 488, in get_players
    data = yield from self.get("https://public-ubiservices.ubi.com/v2/profiles?nameOnPlatform=%s&platformType=%s" % (parse.quote(name), parse.quote(platform)))
  File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\r6sapi\r6sapi.py", line 394, in get
    raise FailedToConnect
r6sapi.r6sapi.FailedToConnect

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

Traceback (most recent call last):
  File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\bot.py", line 846, in process_commands
    yield from command.invoke(ctx)
  File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 374, in invoke
    yield from injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 54, in wrapped
    raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: FailedToConnect: 
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x06962970>```

I get this error when i run my command? any idea on whats wrong and how to fix?
@NG-Bullseye
Copy link

NG-Bullseye commented Apr 12, 2018

Same problem here

Traceback (most recent call last):
File "C:/Users/leona/OneDrive/Programme/Telegram-Bot-master/tele_news.py", line 15, in
asyncio.get_event_loop().run_until_complete(run())
File "C:\Users\leona\AppData\Local\Programs\Python\Python36\lib\asyncio\base_events.py", line 468, in run_until_complete
return future.result()
File "C:/Users/leona/OneDrive/Programme/Telegram-Bot-master/tele_news.py", line 9, in run
player = yield from auth.get_player("NG-Loki", api.Platforms.UPLAY)
File "C:\Users\leona\AppData\Local\Programs\Python\Python36\lib\site-packages\r6sapi\r6sapi.py", line 522, in get_player
results = yield from self.get_players(name=name, platform=platform, uid=uid)
File "C:\Users\leona\AppData\Local\Programs\Python\Python36\lib\site-packages\r6sapi\r6sapi.py", line 488, in get_players
data = yield from self.get("https://public-ubiservices.ubi.com/v2/profiles?nameOnPlatform=%s&platformType=%s" % (parse.quote(name), parse.quote(platform)))
File "C:\Users\leona\AppData\Local\Programs\Python\Python36\lib\site-packages\r6sapi\r6sapi.py", line 394, in get
raise FailedToConnect
r6sapi.r6sapi.FailedToConnect
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000013C2DADE710>

Pls Help

@billy-yoyo
Copy link
Owner

I'll look in to this asap, sorry for the slow reply.

@billy-yoyo billy-yoyo added the bug label Apr 15, 2018
@billy-yoyo billy-yoyo self-assigned this Apr 15, 2018
@NG-Bullseye
Copy link

I only get that exception when I call billy-yoyo's example program from a different class. If I run the script by itself it works.

@billy-yoyo
Copy link
Owner

Three things that might be wrong:

  • max_connect_retries has been set to 0 (e.g. auth = r6sapi.Auth(..., max_connect_retries=0))
  • your email/password is incorrect
  • you're being rate-limited by ubisoft

Is the error happening every time, or does it sometimes work?
The last one is unlikely, unless you've been spamming requests a lot.

@LaughOutQuiet
Copy link
Author

LaughOutQuiet commented Apr 24, 2018

@billy-yoyo It has not been happening very often and it tends to happen after i use a few commands in a shorter time period, over 3 minutes i used 10 commands and i got the error after i successfully executed the 10 commands, sorry for responding late, I don't usually check github (kinda forgot I had it) but i will implement the max_connect_retries

EDIT:
I've tried to implement the max_connect_retries and it does not seem to be working, could you provide an example for me so I can see if I'm doing something wrong?

EDIT 2:

I believe that the reason max_connect_retries is not working is because of the following:

Now I'm getting this error and I don't know what the source is:

Ignoring exception in command r6 operator
Traceback (most recent call last):
  File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 50, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "C:\Users\Matthew\Desktop\Projects\Python\Discord\Bots\Series\Laugh (All in one)\cogs\stats.py", line 277, in _operator
    p = await self.get_player(player, platform)
  File "C:\Users\Matthew\Desktop\Projects\Python\Discord\Bots\Series\Laugh (All in one)\cogs\stats.py", line 90, in get_player
    p = await r6sapi.Auth(email=(config["stats"]["email"]),password=(config["stats"]["password"])).get_player(player, plat)
KeyError: 'stats'

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

Traceback (most recent call last):
  File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\bot.py", line 846, in process_commands
    yield from command.invoke(ctx)
  File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 634, in invoke
    yield from ctx.invoked_subcommand.invoke(ctx)
  File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 374, in invoke
    yield from injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Matthew\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 54, in wrapped
    raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 'stats'

EDIT AGAIN:
sorry i just found the cause of my autism, i renamed a config and forgot to change it in the code ;-;

really sorry about that i tried your fix and it worked my man.

@billy-yoyo
Copy link
Owner

Closing as the issue was fixed, will consider adding better error reporting later so it's more obvious why you're failing to connect, if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants