bbenbenek / nfl-fantasy-football Goto Github PK
View Code? Open in Web Editor NEWThis repo contains scripts to collect and analyze data from Yahoo fantasy football leagues
License: MIT License
This repo contains scripts to collect and analyze data from Yahoo fantasy football leagues
License: MIT License
Hey There,
Noticing an error when trying to run the 'fantasy_stats.py' script. Not sure if this is a similar error to the one reported before in Issue #4
Traceback (most recent call last):
File "/Users/williamchan/PycharmProjects/cll/fantasy_stats.py", line 307, in
main()
File "/Users/williamchan/PycharmProjects/cll/fantasy_stats.py", line 275, in main
bot.run()
File "/Users/williamchan/PycharmProjects/cll/fantasy_stats.py", line 298, in run
UD.UpdateTransactions()
File "/Users/williamchan/PycharmProjects/cll/fantasy_stats.py", line 54, in UpdateTransactions
old_trans = old_transactions['fantasy_content']['league'][1]['transactions']['count']
KeyError: 'fantasy_content'
Thanks for taking a look!
Hey all!
Sorry if this question is naive of me, I'm in the very nascent stages of learning python.
The error I'm running into is in the Data_Transformations.py file I get this error when running the file:
In: runfile('C:/Users/hk/Desktop/FF/nfl-fantasy-football-master/Data Analysis/Data Transformations.py', wdir='C:/Users/hk/Desktop/FF/nfl-fantasy-football-master/Data Analysis')
Traceback (most recent call last):
File "C:\Users\hk\Desktop\FF\nfl-fantasy-football-master\Data Analysis\Data Transformations.py", line 15, in <module>
with open('.\auth\oauth2yahoo.json') as json_yahoo_file:
OSError: [Errno 22] Invalid argument: '.\x07uth\\oauth2yahoo.json'
I tried looking up the Errno but didn't seem to return anything useful.
Any tips on how to resolve are much appreciated!
Thanks,
Hargobind
in fantasy_stats.py on line 271 you are missing a close '.
Hey all,
After running the Data_Transformations.py I'm getting:
Week 1: Team: 1 Traceback (most recent call last): File "X:\PYTHON\projects\nfl-fantasy-football-master\Data Analysis\Data_Transformations.py", line 120, in <module> player_points = float(player_points_json['fantasy_content']['league'][1]['players']['0']['player'][1]['player_points']['total']) KeyError: 'fantasy_content'
X:\PYTHON\projects\nfl-fantasy-football-master\Data Analysis>pause Press any key to continue . . .
Any ideas?
This doesn't pull in data if a player is in the IR spot and updating the league info form doesn't fix the problem. There's an issue within the Data Transformation because the code isn't written for it. Might be something to add for completeness.
Under section 4.4: "fantays_stats.py". The file is "fantasy_stats.py"
Good day,
I am very new to Python but I found your fantasy football and I was trying to pull stats for my friend. I got an error when I tried to run the fantasy_stats.py and it is related to JSONDecodeError. Can anyone help me with this? It is not in your instruction. Do I need to do something with the json\decoder.py?
C:\Users\ker0k\OneDrive\Documents\Python>py fantasy_stats.py
[2023-09-02 09:43:58,181 DEBUG] [yahoo_oauth.oauth.init] Checking
[2023-09-02 09:43:58,181 DEBUG] [yahoo_oauth.oauth.token_is_valid] ELAPSED TIME : 38379.630049705505
[2023-09-02 09:43:58,181 DEBUG] [yahoo_oauth.oauth.token_is_valid] TOKEN HAS EXPIRED
[2023-09-02 09:43:58,181 DEBUG] [yahoo_oauth.oauth.refresh_access_token] REFRESHING TOKEN
[2023-09-02 09:43:58,450 DEBUG] [yahoo_oauth.oauth.token_is_valid] ELAPSED TIME : 0.26961612701416016
[2023-09-02 09:43:58,450 DEBUG] [yahoo_oauth.oauth.token_is_valid] TOKEN IS STILL VALID
Yahoo League Info Updated
[2023-09-02 09:43:58,813 DEBUG] [yahoo_oauth.oauth.init] Checking
[2023-09-02 09:43:58,820 DEBUG] [yahoo_oauth.oauth.token_is_valid] ELAPSED TIME : 0.6397476196289062
[2023-09-02 09:43:58,820 DEBUG] [yahoo_oauth.oauth.token_is_valid] TOKEN IS STILL VALID
[2023-09-02 09:43:58,826 DEBUG] [yahoo_oauth.oauth.token_is_valid] ELAPSED TIME : 0.6458017826080322
[2023-09-02 09:43:58,826 DEBUG] [yahoo_oauth.oauth.token_is_valid] TOKEN IS STILL VALID
League update - Done
[2023-09-02 09:43:59,177 DEBUG] [yahoo_oauth.oauth.init] Checking
[2023-09-02 09:43:59,177 DEBUG] [yahoo_oauth.oauth.token_is_valid] ELAPSED TIME : 0.9960055351257324
[2023-09-02 09:43:59,177 DEBUG] [yahoo_oauth.oauth.token_is_valid] TOKEN IS STILL VALID
[2023-09-02 09:43:59,177 DEBUG] [yahoo_oauth.oauth.token_is_valid] ELAPSED TIME : 0.9960055351257324
[2023-09-02 09:43:59,177 DEBUG] [yahoo_oauth.oauth.token_is_valid] TOKEN IS STILL VALID
Standings update - Done
[2023-09-02 09:43:59,554 DEBUG] [yahoo_oauth.oauth.init] Checking
[2023-09-02 09:43:59,568 DEBUG] [yahoo_oauth.oauth.token_is_valid] ELAPSED TIME : 1.3874835968017578
[2023-09-02 09:43:59,568 DEBUG] [yahoo_oauth.oauth.token_is_valid] TOKEN IS STILL VALID
[2023-09-02 09:43:59,571 DEBUG] [yahoo_oauth.oauth.token_is_valid] ELAPSED TIME : 1.3899612426757812
[2023-09-02 09:43:59,571 DEBUG] [yahoo_oauth.oauth.token_is_valid] TOKEN IS STILL VALID
Scoreboards update - Done
Traceback (most recent call last):
File "C:\Users\ker0k\OneDrive\Documents\Python\fantasy_stats.py", line 307, in
main()
File "C:\Users\ker0k\OneDrive\Documents\Python\fantasy_stats.py", line 275, in main
bot.run()
File "C:\Users\ker0k\OneDrive\Documents\Python\fantasy_stats.py", line 298, in run
UD.UpdateTransactions()
File "C:\Users\ker0k\OneDrive\Documents\Python\fantasy_stats.py", line 28, in UpdateTransactions
old_transactions = json.load(load_file)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ker0k\AppData\Local\Programs\Python\Python311\Lib\json_init_.py", line 293, in load
return loads(fp.read(),
^^^^^^^^^^^^^^^^
File "C:\Users\ker0k\AppData\Local\Programs\Python\Python311\Lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ker0k\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ker0k\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Any idea?
When running the league_authorization script, I'm getting this key error. Any help would be greatly appreciated.
Apologies if this is the wrong place, but it seems I'm unable to pull data into the 'Data Transformations.py' from the superflex position in my league. I've tried a number of different inputs such as "Q/W/R/T' or as Yahoo displays it 'Q/W\nR/T'. The output .csv has the position totally blank. Any assistance here would be appreciated.
Oops - another KeyError. This time KeyError: 'game'. Trying to trace back to see where the issue could be but could use your help on this one @bbenbenek !
Traceback (most recent call last):
File "/Users/williamchan/PycharmProjects/cll/fantasy_stats.py", line 307, in
main()
File "/Users/williamchan/PycharmProjects/cll/fantasy_stats.py", line 275, in main
bot.run()
File "/Users/williamchan/PycharmProjects/cll/fantasy_stats.py", line 286, in run
UD.UpdateYahooLeagueInfo()
File "/Users/williamchan/PycharmProjects/cll/fantasy_stats.py", line 207, in UpdateYahooLeagueInfo
game_key = r['fantasy_content']['game'][0]['game_key'] # game key as type-string
KeyError: 'game'
Is it possible to run this code for multiple leagues?
The only workaround I got it to save the repository multiple times, one for each Yahoo league and run it manually.
Could a feature be added to include additional leagues?
I am working on adding a method to update data to acquire player stats from the player endpoints. currently in fantasy_stats.py you only pull data from the rosters endpoint. currently only able to pull the same 24 players from the players endpoint even when a player key is added.
When I run the data transformation file, I am getting the following error:
raise JSONDecodeError("Expecting value", s, err.value) from None
JSONDecodeError: Expecting value
Any ideas on work arounds?
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.