Releasing fpl 0.5.2 - Adding a CLI

in #fpl6 years ago




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

fpl_myteam_login.gif

Wrong email address / password

fpl_myteam_login_validation.gif

With environment variables

fpl_myteam_no_login.gif

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.

fpl_picks.gif


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!

Sort:  

Hello there,

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.

Sadly, I still have the same error on a fresh python3.6 virtual environment install from pypi on the latest version. After further review, I believe the problem is on the setup.py.

Looks like the packages field in the setup() needs also fpl.models. It should be: packages=["fpl", "fpl.models"].

This happened to me a couple of times in the past, the best way to avoid this, using find_packages instead of hard coding package names.


Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you for your review, @emrebeyler!

So far this week you've reviewed 1 contributions. Keep up the good work!

Hey, @amosbastian

Thank you for your contribution

So far you've submitted 12 contributions on Utopian. Keep up the good work!

Your 12 contributions have been appoved and upvoted by Utopian

Here is your contributions details..

  • Development : 8
Your total payout for 12 contributions is $ 874.88

Hey, we have noticed your recent activity and it looks like you provide informative comments regarding the contributor's history. However, as this account is not associated with Utopian.io and accounts in Steem.

Furthermore, to avoid any confusion, please consider not using the Utopian logo in your profile without permission.

Nonetheless, the project looks interesting.

Hi @espoem
Thanks for your suggestion and advise. Yes today itself this bot came into action as part of utopian contribution and i'm glad to be part of utopian.io, i will look into that. Till further approval i will be removing utopian logo.

Thank you

Hi @amosbastian!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hey, @amosbastian!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 62964.22
ETH 2595.61
USDT 1.00
SBD 2.74