rbarton65 / espnff Goto Github PK
View Code? Open in Web Editor NEWESPN Fantasy Football API
ESPN Fantasy Football API
Any idea how one would adapt this to ESPNs fantasty baseball? Would it use a similar or different API?
Request: Power rankings take week as optional argument.
Assume current week like with scoreboard if no week provided.
I see the revision to the team parameter on JUL 28 with the fetch_roster parameter but I'm unable to correctly pull roster information
Thank you for your time, this script is a lifesaver
Is there a known endpoint for getting a team's roster (for future support)?
Getting:
league = League(719284, 2017)
Traceback (most recent call last):
File "", line 1, in
File "/Users/Ash/Downloads/espnff-master/espnff/league.py", line 22, in init
self._fetch_league()
File "/Users/Ash/Downloads/espnff-master/espnff/league.py", line 42, in _fetch_league
data = r.json()
File "/anaconda/lib/python3.6/site-packages/requests/models.py", line 877, in json
self.content.decode(encoding), **kwargs
File "/anaconda/lib/python3.6/site-packages/simplejson/init.py", line 516, in loads
return _default_decoder.decode(s)
File "/anaconda/lib/python3.6/site-packages/simplejson/decoder.py", line 374, in decode
obj, end = self.raw_decode(s)
File "/anaconda/lib/python3.6/site-packages/simplejson/decoder.py", line 404, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
This is not an issue with your code but espnff is affected.
for some reason the scoreboard API just kind breaks when making requests for my league, for a specified matchup period, when making a request for data 2+ years old.
For example the Json get request --> http://games.espn.com/ffl/api/v2/scoreboard?leagueId=censored&seasonId=2015&matchupPeriodId=3
returns this -->{"error":[{"code":"exception","message":"java.lang.NullPointerException"}]}
If i request data for 2017 or 2018 I have no issues... Any idea whats going on here?
I see you added cookie support, and I was able to hack my way into using it. However, I think you should document this, and provide a method for setting your cookies. The only way I could get this to work was by hacking the cookie var in the module itself.
From what I can tell, some big changes to the ESPN fantasy platform may have changed the format of the JSON this package parses. Especially when attempting to get the leage: league = League(league_id, year)
.
I get a JSONDecodeError("Expecting value", s, err.value) from None
followed by json.decoder.JSONDecodeError: Expecting value: line 2 column 2 (char 2)
. Can anyone else confirm this problem?
It appears that ESPN has disallowed access to this data unfortunately
>>> league.scoreboard()
File "/usr/lib/python3.5/site-packages/espnff-1.2.2-py3.5.egg/espnff/espnff.py", line 120, in scoreboard
File "/usr/lib/python3.5/site-packages/espnff-1.2.2-py3.5.egg/espnff/espnff.py", line 120, in <listcomp>
File "/usr/lib/python3.5/site-packages/espnff-1.2.2-py3.5.egg/espnff/espnff.py", line 178, in __init__
File "/usr/lib/python3.5/site-packages/espnff-1.2.2-py3.5.egg/espnff/espnff.py", line 188, in _fetch_matchup_info
IndexError: list index out of range
I noticed the player.py
file is empty. Do you plan to add the player endpoints to this library?
Is there a concise mathematical explanation of the meaning of the power rankings provided by this library? Is this a known formula for computing them?
Pretty new to Python but trying to get all stats into Excel for reporting/metrics over 10 years. Is there a good way to do a CSV dump for every year?
Hello,
Hopfully this is something simple, but what is the .mov in the example?
team1.mov
[32.12, 24.92, 45.97, 34.17, 41.74, -5.39, 1.15, 0, 0, 0, 0, 0, 0, 0]
Thanks!
P.S. I'm doing a unique scoring system so this is really helping my automate the scoring each week and display it on a web page, thanks so much!!
Able to load a year when there was a trade deadline.
Unable to load a year when there was no trade deadline.
Receive the following error "KeyError: 'tradeDeadline'"
There is a typo in league.py, line 108
'matchupPeriodId' should be 'matchUpPeriodId' else there is an error when trying to get the scoreboard by week.
So I'm a little confused. I wasn't able to get this working on my machine, but before I dig into it too much... I'm curious how you were able to use the ESPN Fantasy Football API, seeing as they stopped issuing new API keys in 2012, and cut off all use in 2014 . Furthermore, I haven't been able to find any information online that would suggest that ESPN has a Fantasy Football API available at this moment. So I'm just curious if, and how, this works on the back-end?
Hey there,
Sorry for creating an issue, but I came across this script and would love to use it for my league. Problem is, I'm a noob with Python and I'm not sure how to get the rankings returned. Are there any beginner tutorials you could point me towards (or simple instructions) on how to run this locally on OS X to get the rankings? I've got MAMP and Coda installed if that helps. Thank you!
Hi, this is an interesting project. Is there any chance of supporting private leagues using stored credentials in the future via OAuth or whatever the ESPN backend is using?
It looks like there's a discrepancy between the project files at PyPI (https://pypi.org/project/espnff/1.3.1/#files) versus in this repository and the latest version on master. Is there any plans to update it? I'd love to be able to use this package in a project of mine without having to download the source, and I am currently seeing this issue #22 when I install with pip.
technically this isn't completely necessary since it can be inferred using the number regular season vs total weeks and the number of playoff teams, but it would be a nice feature
number of playoff rounds goes along with this too
TL;DR deleted members mess up the matrix math so your dominance matrix and thus power rankings won't be correct
My league has been ongoing since 2016. Since then we've had to delete two members, but in ESPN they still retain that team id (6 and 8 in my case). When the code goes to develop the win matrices for the power rankings, it loops through the teams_sorted array: "for team in teams_sorted:"
The teams_sorted array correctly ignores the deleted teams. However, the win matrix is built upon opponent.team_id, so the team_id for 6 and 8 (array position 5 and 7) still exists. That outputs a matrix with rows != columns (rows follow teams_sorted list, columns follow opponent.team_id). Then, the matrix math uses len(X) where X is the win_matrix for its loops. len(X) gives you the number of rows in the matrix (since a matrix in python is really just a list of list). In my case, this meant that any wins against the two newer teams were ignored because there were 12 rows but 14 columns and the last 2 columns were the 2 newer members.
Sorry for the wall of text, but I was trying to step through to make it clear. I'll see if I can get a PR in but if someone else gets to this before me it's all theirs
I was just playing around with this (very cool!), and it seems like some of the Team
attribute names are wrong in the README. For example, points_for
should be pointsFor
(similarly for a few of the others).
I'm not sure which way you want (points_for
is probably more pythonic), so probably it's best to follow the README and switch the attributes. If you are interested in help on this project I could submit a PR.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.