amosbastian / fpl

An asynchronous Python wrapper for the Fantasy Premier League API.
https://fpl.readthedocs.io
MIT License
302 stars 96 forks source link

Can we access previous year data from the player object #89

Closed ajayrfhp closed 4 years ago

ajayrfhp commented 4 years ago

Can we get a list of scores obtained by a player in the previous FPL years ?

amosbastian commented 4 years ago

Do you mean this data?

image

If so, then you can get this like this:

from fpl import FPL
import aiohttp
import asyncio

async def main():
    async with aiohttp.ClientSession() as session:
        fpl = FPL(session)
        player = await fpl.get_player(1, include_summary=True)
    print(player.history_past)

asyncio.run(main())

If you mean points by week, then you would have to get it from something like this: https://github.com/vaastav/Fantasy-Premier-League

ajayrfhp commented 4 years ago

Yeah I need the points per week, I will checkout the link you posted. Thank you.