cgrok / clashroyale

Async + Sync wrapper for royaleapi.com and the CR official API
MIT License
47 stars 19 forks source link

Bug with request_info #30

Closed thecaralice closed 5 years ago

thecaralice commented 5 years ago

Describe the bug I'm making Discord bot using your API. When I try to get all the cards I get an exception

Full Code

import asyncio

import discord
from discord.ext import commands
import clashroyale

from const import *

bot = commands.Bot(command_prefix='$', description='Бот для MGC', command_not_found='Команды {} не существует', command_has_no_subcommands='У команды {} нет подкоманд')

cr_client = clashroyale.official_api.Client(CR_TOKEN, is_async=True)

@bot.group()
async def clashroyale():
    pass

@clashroyale.command()
async def cards():
    c = await cr_client.get_all_cards()
    await bot.say(c)

bot.run(TOKEN)

Expected behavior A clear and concise description of what you expected to happen.

Actual behavior

Traceback (most recent call last):
  File "C:\Users\iVan\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 50, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "x-wingide-python-shell://102272144/2", line 19, in cards
  File "C:\Users\iVan\AppData\Local\Programs\Python\Python36\lib\site-packages\clashroyale\official_api\client.py", line 215, in _aget_model
    raise e
  File "C:\Users\iVan\AppData\Local\Programs\Python\Python36\lib\site-packages\clashroyale\official_api\client.py", line 208, in _aget_model
    data, cached, ts, resp = await self._request(url, **params)
  File "C:\Users\iVan\AppData\Local\Programs\Python\Python36\lib\site-packages\clashroyale\official_api\client.py", line 157, in _arequest
    return self._raise_for_status(resp, await resp.text())
  File "C:\Users\iVan\AppData\Local\Programs\Python\Python36\lib\site-packages\clashroyale\official_api\client.py", line 125, in _raise_for_status
    log.debug(self.REQUEST_LOG.format(method=method or resp.request_info.method, url=resp.url, text=text, status=code))
AttributeError: 'ClientResponse' object has no attribute 'request_info'

Additional context Add any other context about the problem here.

fourjr commented 5 years ago

Can you run this command? python -c print(__import__('clashroyale').__version__)

thecaralice commented 5 years ago

@fourjr

Can you run this command? python -c print(__import__('clashroyale').__version__)

v4.0.1

fourjr commented 5 years ago

Do you still face the bug?

thecaralice commented 5 years ago

No, thx