How to use the fpl.models.classic_league.ClassicLeague function in fpl

To help you get started, we’ve selected a few fpl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github amosbastian / fpl / tests / test_classic_league.py View on Github external
async def test_init(self, loop):
        session = aiohttp.ClientSession()
        classic_league = ClassicLeague(classic_league_data, session)
        assert classic_league._session is session
        for k, v in classic_league_data.items():
            assert getattr(classic_league, k) == v
        await session.close()
github amosbastian / fpl / tests / test_fpl.py View on Github external
async def test_classic_league(self, loop, fpl):
        await fpl.login()
        classic_league = await fpl.get_classic_league(173226)
        assert isinstance(classic_league, ClassicLeague)

        classic_league = await fpl.get_classic_league(173226, return_json=True)
        assert isinstance(classic_league, dict)
github amosbastian / fpl / fpl / fpl.py View on Github external
:param return_json: (optional) Boolean. If ``True`` returns a ``dict``,
            if ``False`` returns a :class:`ClassicLeague` object. Defaults to
            ``False``.
        :type return_json: bool
        :rtype: :class:`ClassicLeague` or ``dict``
        """
        if not logged_in(self.session):
            raise Exception("User must be logged in.")

        url = API_URLS["league_classic"].format(league_id)
        league = await fetch(self.session, url)

        if return_json:
            return league

        return ClassicLeague(league, session=self.session)