Python wrapper for the Fantasy Premier League API

in #utopian-io7 years ago (edited)

fpl-python.png

I was browsing https://utopian.io/ earlier in the week and came across a great post by @emrebeyler where he showcased his Python wrapper for the Utopian API and this inspired me to make one for the Fantasy Premier League API!

The Fantasy Premier League is a game, with more than five million users, in which users assemble their fantasy team consisting of real footballers and score points based on those players' performances in real life. The game is also huge on Steemit, with @acidyo and @arsenal49 doing great work!

Personally I do a lot of programming in Python with the Fantasy Premier League API and have made this wrapper to make my life and other people's lives easier when doing this, as there surprisingly isn't already one (at least from what I could find). I've never done something like this before, so I've used @emrebeyler's API as a huge example for my first, basic version 0.2.0.

Installation

pip install fpl

Usage

import fpl
fpl = fpl.FPL()

Documentation

  • Get specific user
print(fpl.user("3523615"))
  • Get specific user's history
print(fpl.user_history("3523615"))
  • Get specific user's picks
print(fpl.user_picks("3523615"))
  • Get specific user's cup information
print(fpl.user_cup("3523615"))
  • Get specific user's transfers
print(fpl.user_transfers("3523615"))
  • Get specific user's entered leagues
print(fpl.user_leagues_entered("3523615"))
  • Get teams
print(fpl.teams)
  • Get players
print(fpl.players)
  • Get specific player
print(fpl.player("123"))
  • Get gameweeks
print(fpl.gameweeks)
  • Get specific gameweek
print(fpl.gameweek(20))
  • Get game settings
print(fpl.game_settings)
  • Get specific classic league information
print(fpl.classic_league("743038"))
  • Get specific h2h league information
print(fpl.h2h_league("28281"))

Tests

$ python test.py 
..............
----------------------------------------------------------------------
Ran 14 tests in 3.687s

OK

Improvements

In the future I will be looking at other Python wrappers like PRAW and python-twitter and improving my own wrapper to (hopefully) be of a similar quality as those two.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @amosbastian I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.16
TRX 0.16
JST 0.031
BTC 59316.00
ETH 2518.25
USDT 1.00
SBD 2.43