rhgrant10 / berserk

Python client for the lichess API
https://berserk.readthedocs.io
Other
142 stars 36 forks source link

Get tournament bug #50

Open Serezha139 opened 2 years ago

Serezha139 commented 2 years ago

Description

trying to get tournament data

What I Did

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

class LichessDataLoadService: def init(self): session = berserk.TokenSession(settings.BNL_TOKEN) self.client = berserk.Client(session=session)

def get_tournament_data(self, tournament_id):
    data = self.client.tournaments.get_tournament(tournament_id)
    return data

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/code.py", line 90, in runcode exec(code, self.locals) File "", line 1, in File "/Users/givanov/PycharmProjects/bnl_landing/bnl_league/bnl_league/common/services/lichess_api_service.py", line 11, in get_tournament_data data = self.client.tournaments.get_tournament(tournament_id) File "/Users/givanov/PycharmProjects/bnl_landing/venv/lib/python3.8/site-packages/berserk/clients.py", line 995, in get_tournament return self._r.get(path, converter=models.Tournaments.convert_values) File "/Users/givanov/PycharmProjects/bnl_landing/venv/lib/python3.8/site-packages/berserk/session.py", line 60, in get return self.request('GET', *args, **kwargs) File "/Users/givanov/PycharmProjects/bnl_landing/venv/lib/python3.8/site-packages/berserk/session.py", line 56, in request return fmt.handle(response, is_stream=is_stream, converter=converter) File "/Users/givanov/PycharmProjects/bnl_landing/venv/lib/python3.8/site-packages/berserk/formats.py", line 35, in handle return converter(self.parse(response)) File "/Users/givanov/PycharmProjects/bnl_landing/venv/lib/python3.8/site-packages/berserk/models.py", line 27, in convert_values data[k] = cls.convert(data[k]) File "/Users/givanov/PycharmProjects/bnl_landing/venv/lib/python3.8/site-packages/berserk/models.py", line 16, in convert return cls.convert_one(data) File "/Users/givanov/PycharmProjects/bnl_landing/venv/lib/python3.8/site-packages/berserk/models.py", line 20, in convert_one for k in set(data) & set(cls.conversions): TypeError: 'int' object is not iterable

rhgrant10 commented 2 years ago

Hi @Serezha139 , not sure how to reproduce this. There hasn't been a v0.11.8 of berserk and the latest version doesn't contain a client.tournaments.get_tournament method. Can you help me understand what you're trying to do here?