create account

Releasing fpl 0.5.2 - Adding a CLI by amosbastian

View this thread on: hive.blogpeakd.comecency.com
· @amosbastian ·
$139.48
Releasing fpl 0.5.2 - Adding a CLI
<center>![](https://cdn.steemitimages.com/DQmct1Fn9wFPms4zL6uzti3x5Bc9rCBfGxPZPzEXwVgiE8A/image.png)
<br>
<b>fpl</b>
<br>
A Python wrapper around the Fantasy Premier League API.
</center>

#### 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
<center>![fpl_myteam_login.gif](https://cdn.steemitimages.com/DQmZ1DJ1iXfXcCpnPuzrh7KPVHF2UymvWpnxV2Li9Fa7JwC/fpl_myteam_login.gif)</center>

#### Wrong email address / password
<center>![fpl_myteam_login_validation.gif](https://cdn.steemitimages.com/DQmPP6Wu3sPgQwNYQprSgxtUnTAmqAP6bALSLyChT4kZdcz/fpl_myteam_login_validation.gif)</center>

#### With environment variables
<center>![fpl_myteam_no_login.gif](https://cdn.steemitimages.com/DQmXyAYMCQAo3iuwAzwF4AVgtPpxNadfcrKAnzz4twftgiE/fpl_myteam_no_login.gif)</center>

## 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.

<center>![fpl_picks.gif](https://cdn.steemitimages.com/DQmPd7SDTpHYmFyZqxc3HsjMGK1CgMeTzLRceBEGUrrAtdc/fpl_picks.gif)</center>

---

## Small fix

Yesterday someone created [an issue](https://github.com/amosbastian/fpl/issues/10) 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!
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authoramosbastian
permlinkreleasing-fpl-0-5-2-adding-a-cli
categoryfpl
json_metadata{"community":"steempeak","app":"steempeak","format":"markdown","tags":["fpl","utopian-io","development","python","football"],"links":["https://github.com/amosbastian/fpl","https://github.com/amosbastian/fpl/pull/11","https://github.com/amosbastian/fpl/issues/10"],"image":["https://cdn.steemitimages.com/DQmct1Fn9wFPms4zL6uzti3x5Bc9rCBfGxPZPzEXwVgiE8A/image.png","https://cdn.steemitimages.com/DQmZ1DJ1iXfXcCpnPuzrh7KPVHF2UymvWpnxV2Li9Fa7JwC/fpl_myteam_login.gif","https://cdn.steemitimages.com/DQmPP6Wu3sPgQwNYQprSgxtUnTAmqAP6bALSLyChT4kZdcz/fpl_myteam_login_validation.gif","https://cdn.steemitimages.com/DQmXyAYMCQAo3iuwAzwF4AVgtPpxNadfcrKAnzz4twftgiE/fpl_myteam_no_login.gif","https://cdn.steemitimages.com/DQmPd7SDTpHYmFyZqxc3HsjMGK1CgMeTzLRceBEGUrrAtdc/fpl_picks.gif"]}
created2018-10-04 16:00:12
last_update2018-10-04 16:00:12
depth0
children7
last_payout2018-10-11 16:00:12
cashout_time1969-12-31 23:59:59
total_payout_value105.526 HBD
curator_payout_value33.958 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,462
author_reputation174,473,586,900,705
root_title"Releasing fpl 0.5.2 - Adding a CLI"
beneficiaries
0.
accountutopian.pay
weight500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id72,623,400
net_rshares85,073,502,984,519
author_curate_reward""
vote details (48)
@emrebeyler · (edited)
$8.57
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](https://setuptools.readthedocs.io/en/latest/setuptools.html#using-find-packages) instead of hard coding package names.

***

Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/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](https://review.utopian.io/result/3/2221211).

---- 
Need help? Write a ticket on https://support.utopian.io/. 
Chat with us on [Discord](https://discord.gg/uTyJkNm). 
[[utopian-moderator]](https://join.utopian.io/)
πŸ‘  , , , , , , , , , ,
properties (23)
authoremrebeyler
permlinkre-amosbastian-releasing-fpl-0-5-2-adding-a-cli-20181004t220314640z
categoryfpl
json_metadata{"tags":["fpl"],"links":["https://setuptools.readthedocs.io/en/latest/setuptools.html#using-find-packages","https://join.utopian.io/guidelines","https://review.utopian.io/result/3/2221211","https://support.utopian.io/","https://discord.gg/uTyJkNm","https://join.utopian.io/"],"app":"steemit/0.1"}
created2018-10-04 22:03:15
last_update2018-10-04 22:05:33
depth1
children1
last_payout2018-10-11 22:03:15
cashout_time1969-12-31 23:59:59
total_payout_value6.489 HBD
curator_payout_value2.079 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,275
author_reputation448,535,049,068,622
root_title"Releasing fpl 0.5.2 - Adding a CLI"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id72,639,972
net_rshares5,056,432,683,973
author_curate_reward""
vote details (11)
@utopian-io ·
Thank you for your review, @emrebeyler!

So far this week you've reviewed 1 contributions. Keep up the good work!
properties (22)
authorutopian-io
permlinkre-re-amosbastian-releasing-fpl-0-5-2-adding-a-cli-20181004t220314640z-20181008t015538z
categoryfpl
json_metadata"{"app": "beem/0.20.1"}"
created2018-10-08 01:55:39
last_update2018-10-08 01:55:39
depth2
children0
last_payout2018-10-15 01:55:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length113
author_reputation152,955,367,999,756
root_title"Releasing fpl 0.5.2 - Adding a CLI"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id72,839,675
net_rshares0
@steem-ua ·
#### 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](https://discord.gg/KpBNYGz)**
properties (22)
authorsteem-ua
permlinkre-releasing-fpl-0-5-2-adding-a-cli-20181005t085550z
categoryfpl
json_metadata"{"app": "beem/0.20.5"}"
created2018-10-05 08:55:51
last_update2018-10-05 08:55:51
depth1
children0
last_payout2018-10-12 08:55:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length290
author_reputation23,214,230,978,060
root_title"Releasing fpl 0.5.2 - Adding a CLI"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id72,667,361
net_rshares0
@utopian-buddy ·
Hey, @amosbastian
<p><strong>Thank you for your contribution </strong></p>So far you've submitted <strong>12</strong> contributions on Utopian. Keep up the good work! 
<p>Your <strong>12</strong> contributions have been appoved and upvoted by Utopian</p><p><strong>Here is your contributions details..</strong></p>
<ul type='square'><li>Development  : <strong>8</strong></li></ul>
Your total payout for <strong>12</strong> contributions is <strong>$ 874.88</strong>
πŸ‘  
properties (23)
authorutopian-buddy
permlinkreleasing-fpl-0-5-2-adding-a-cli-utopian-post-stats
categoryfpl
json_metadata{"tags":["utopian-io"],"app":"utopian-buddy"}
created2018-10-04 16:04:09
last_update2018-10-04 16:04:09
depth1
children2
last_payout2018-10-11 16:04:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length465
author_reputation141,790,228
root_title"Releasing fpl 0.5.2 - Adding a CLI"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id72,623,683
net_rshares5,498,249,590
author_curate_reward""
vote details (1)
@espoem · (edited)
$0.07
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.
πŸ‘  
properties (23)
authorespoem
permlinkre-utopian-buddy-releasing-fpl-0-5-2-adding-a-cli-utopian-post-stats-20181004t164737270z
categoryfpl
json_metadata{"tags":["fpl"],"app":"steemit/0.1"}
created2018-10-04 16:47:39
last_update2018-10-04 16:52:24
depth2
children1
last_payout2018-10-11 16:47:39
cashout_time1969-12-31 23:59:59
total_payout_value0.064 HBD
curator_payout_value0.009 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length373
author_reputation59,289,149,412,912
root_title"Releasing fpl 0.5.2 - Adding a CLI"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id72,625,937
net_rshares49,468,626,702
author_curate_reward""
vote details (1)
@utopian-buddy ·
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
properties (22)
authorutopian-buddy
permlinkre-espoem-re-utopian-buddy-releasing-fpl-0-5-2-adding-a-cli-utopian-post-stats-20181004t170102845z
categoryfpl
json_metadata{"tags":["fpl"],"users":["espoem"],"app":"steemit/0.1"}
created2018-10-04 17:01:06
last_update2018-10-04 17:01:06
depth3
children0
last_payout2018-10-11 17:01:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length263
author_reputation141,790,228
root_title"Releasing fpl 0.5.2 - Adding a CLI"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id72,626,571
net_rshares0
@utopian-io ·
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](https://chrome.google.com/webstore/detail/steemplus/mjbkjgcplmaneajhcbegoffkedeankaj?hl=en) or [Steeditor](https://steeditor.app)).

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

<a href='https://steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
properties (22)
authorutopian-io
permlinkre-releasing-fpl-0-5-2-adding-a-cli-20181007t045013z
categoryfpl
json_metadata"{"app": "beem/0.20.1"}"
created2018-10-07 04:50:15
last_update2018-10-07 04:50:15
depth1
children0
last_payout2018-10-14 04:50:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length593
author_reputation152,955,367,999,756
root_title"Releasing fpl 0.5.2 - Adding a CLI"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id72,782,621
net_rshares0