alan-turing-institute / AIrsenal

Machine learning Fantasy Premier League team
MIT License
295 stars 87 forks source link

Logging in issue #608

Closed LukeJGlass closed 1 year ago

LukeJGlass commented 1 year ago

Hello,

I seem to have an issue when the app tries to login. I have created the ID, username, password like it has mentioned to do. Seems i am getting the captcha issue but also a JS and Ad Blocker error, i have disabled the ad blocker and JS is enabled.

airsenal_make_transfers Making transfer list for starting team Error loging in: b'<html><head><title>premierleague.com</title><style>#cmsg{animation: A 1.5s;}@keyframes A{0%{opacity:0;}99%{opacity:0;}100%{opacity:1;}}</style></head><body style="margin:0"><p id="cmsg">Please enable JS and disable any ad blocker</p><script data-cfasync="false">var dd={\'rt\':\'c\',\'cid\':\'AHrlqAAAAAMAv3zs-KAwIAwArfQ-KA==\',\'hsh\':\'5DE3E6A7D87D0E4E8979F7A1C7BD73\',\'t\':\'fe\',\'r\':\'b\',\'s\':37449,\'e\':\'064a80eb57729f0e2ad537db5500fe14bff0a54c922bd70aa3e847731317b608\',\'host\':\'geo.captcha-delivery.com\'}</script><script data-cfasync="false" src="https://ct.captcha-delivery.com/c.js"></script></body></html>\n' Unable to access FPL API Traceback (most recent call last): File "/home/fate/miniconda3/envs/airsenalenv/bin/airsenal_make_transfers", line 8, in <module> sys.exit(main()) File "/home/fate/miniconda3/envs/airsenalenv/lib/python3.9/site-packages/airsenal/scripts/make_transfers.py", line 347, in main make_transfers(args.fpl_team_id, confirm) File "/home/fate/miniconda3/envs/airsenalenv/lib/python3.9/site-packages/airsenal/scripts/make_transfers.py", line 307, in make_transfers priced_transfers = build_init_priced_transfers(fetcher, team_id) File "/home/fate/miniconda3/envs/airsenalenv/lib/python3.9/site-packages/airsenal/scripts/make_transfers.py", line 247, in build_init_priced_transfers current_squad = fetcher.get_current_picks(fpl_team_id) File "/home/fate/miniconda3/envs/airsenalenv/lib/python3.9/site-packages/airsenal/framework/data_fetcher.py", line 175, in get_current_picks return squad_data["picks"] TypeError: 'NoneType' object is not subscriptable

exenrnov commented 1 year ago

I second this. Got same problem.

jack89roberts commented 1 year ago

Hmm this is going to make things difficult. They've slowly been adding additional checks to the API/login, which we've seen come up for people in a few countries before but now it seems more widespread. We can put in a fix to run AIrsenal without needing to login at least.

Or weirdly just trying to login again seems to work for me:

from airsenal.framework.utils import fetcher
fetcher.login()  # fails with error above
fetcher.login()  # succeeds

So maybe we can:

  1. Attempt to login a few times
  2. Make it possible to run without logging in (+add a warning message that this has happened)

We'll look at it asap.

LukeJGlass commented 1 year ago

Thanks for the quick response and also love the tool, very cool! I notice another error, unsure if its my end or not and if it affects the tool at all but thought i would let you know.

When running the airsenal_check_data i get the following: `SUMMARY

Seasons: ['2324', '2223', '2122', '2021']

season_num_teams: OK! season_num_new_teams: OK! season_num_fixtures: OK! fixture_player_teams: OK! fixture_num_players: FAIL! 19 errors. fixture_num_goals: OK! fixture_num_assists: OK! fixture_num_conceded: OK! Checking 11 to 14 players play per team in each fixture... Note:

2223 GW14 NEW 4 - 0 AVL: 17 players with minutes > 0 for home team. 2223 GW22 MUN 2 - 2 LEE: 17 players with minutes > 0 for away team. 2223 GW24 CHE 0 - 1 SOU: 17 players with minutes > 0 for home team. 2223 GW24 CHE 0 - 1 SOU: 17 players with minutes > 0 for away team. 2122 GW5 AVL 3 - 0 EVE: 15 players with minutes > 0 for home team. 2122 GW5 AVL 3 - 0 EVE: 15 players with minutes > 0 for away team. 2122 GW6 WAT 1 - 1 NEW: 15 players with minutes > 0 for home team. 2122 GW11 MUN 0 - 2 MCI: 15 players with minutes > 0 for home team. 2122 GW12 WAT 4 - 1 MUN: 15 players with minutes > 0 for away team. 2122 GW23 BRE 1 - 2 WOL: 16 players with minutes > 0 for home team. 2122 GW30 WOL 2 - 3 LEE: 15 players with minutes > 0 for home team. 2122 GW30 WOL 2 - 3 LEE: 15 players with minutes > 0 for away team. 2122 GW37 NEW 2 - 0 ARS: 15 players with minutes > 0 for home team. 2122 GW37 NEW 2 - 0 ARS: 15 players with minutes > 0 for away team. 2122 GW38 LEI 4 - 1 SOU: 15 players with minutes > 0 for home team. 2122 GW38 LEI 4 - 1 SOU: 15 players with minutes > 0 for away team. 2021 GW25 ARS 0 - 1 MCI: 15 players with minutes > 0 for home team. 2021 GW28 WOL 0 - 1 LIV: 15 players with minutes > 0 for home team. 2021 GW30 LEE 2 - 1 SHU: 15 players with minutes > 0 for away team.

FAIL! 19 errors. `

jack89roberts commented 1 year ago

@flexa1 Thanks for reporting - that is issue #353 I think. Basically we don't have a way of knowing when there were concussion substitutes so more players can appear in a match than expected. Though there are more than I'd expect so I'll look into it again at some point.