billy-yoyo / RainbowSixSiege-Python-API

Asynchronous python api for rainbow six siege (r6sapi)
MIT License
129 stars 31 forks source link

BUG: Calling load_rank / get_rank freezes loop #77

Open DJJ05 opened 3 years ago

DJJ05 commented 3 years ago

Here is my full code:

        try:
            account = await self.auth.get_player(account_name, r6sapi.Platforms.UPLAY)
        except r6sapi.exceptions.InvalidRequest:
            raise commands.BadArgument("Couldn't find a Uplay account with that name.")

        try:
            await account.check_level()
            await account.check_general()
            # await account.load_rank('NA')
        except:
            raise commands.BadArgument("Found the Uplay account but couldn't gather any information.")

After executing this code, accessing attributes such as matches_won, or xp seems to work fine, however as soon as the commented out load_rank is added into the program, the program will never go past that, any code below that line will not execute at all, and no exceptions are caught by the except clause. It seems to simply freeze the loop when ran.

DJJ05 commented 3 years ago

Update:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/r6sapi/players.py", line 307, in get_rank
    result = yield from self.load_rank(region, season, data=data)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/r6sapi/players.py", line 277, in load_rank
    rank_definitions = yield from self.auth.get_rank_definitions()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/r6sapi/auth.py", line 522, in get_rank_definitions
    data = yield from resp.json()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1097, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://www.ubisoft.com/en-gb/game/rainbow-six/siege/stats')

After waiting several minutes, the program eventually throws a ContentTypeError. This applies for all 3 regions I've tried, NA, EU, and ASIA.

Jackywathy commented 3 years ago

what version of the library are you using?