fpl
A Python wrapper around the Fantasy Premier League API.
Repository
https://github.com/amosbastian/fpl
Pull request
https://github.com/amosbastian/fpl/pull/11
Installation and upgrading
# installation
pip install fpl
# upgrading
pip install fpl --upgrade
Usage: fpl [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
myteam Echoes a logged in user's team to the terminal.
picks Echoes a user's picks to the terminal.
One of the items in my roadmap for fpl was adding a CLI, so I decided to start implementing that. It includes two commands so far, myteam and picks, which show a user's team and picks respectively. ANSI colour codes are used to colour the players depending on their status, and PTable is used to format some additional information in an aesthetically pleasing way.
The myteam command
As mentioned in my previous post, to see a user's current team, you need to be logged in as the user (otherwise people could just copy your team). So, this command echoes a user's team to the terminal, which also includes additional information about a user's overall performance, after the user has logged in. If a wrong email address or password is entered this is shown as an error, and if a user has the FPL_EMAIL and FPL_PASSWORD environment variables set then they don't need to log in.
Using email address and password
Wrong email address / password
With environment variables
The picks command
This command echoes a user's picks to the terminal, which includes additional information about their performance in the current gameweek. It does not require the user to be logged in to see this information, so you can enter any user's ID that you want to. In comparison to the myteam command it shows the points scored by each player in the current gameweek.
Small fix
Yesterday someone created an issue about a failure to import module(s). In this update this has hopefully also been fixed (it works for me), but I am waiting to hear back from him to confirm this is also the case for him.
CLI roadmap
I have a couple of commands / things I want to add to the CLI:
- A way to add an account locally, similar to
beempy importaccount - Favouriting users, since it's a hassle to type in a user's ID, and there is seemingly no way to map an email address to a user ID using their API
- A command that streams information about your team / all the players currently playing if the gameweek is live
If you have any thoughts about this please let me know. Especially ideas for new commands or suggestions to improve existing ones are very much appreciated!