Closed voicelessreason closed 5 years ago
Oh, my apologies, I've figured out my issue. I was using my username, but in reality, the API expects the email associated with the account (which can be different than username). The documentation should probably be updated to reflect that.
Interesting I thought I used my username to test out the Authentication. I will look into and make sure the documentation is updated!
Thanks!
Oh interesting, I wonder if its contingent on how you created your account or something like that...in my case my username was always denied and email always accepted but I'm not sure if thats universally the case.
Actually, now I'm not too sure anymore. I'm failing to authenticate at all, unless going with a public league. Must've had a false positive before with the email. So I'm not sure what's broken but unfortunately the only output I get is Access Denied so not immediately sure what the issue is
Hmm could you show me an example on how you are calling the League constructor with your sensitive info faked
Sure, I created a mini script just to test this...
from ff_espn_api import League
from os import system, name
league = League(SAMPLE_ID, 2019)
print(league)
league = League(SAMPLE_ID, 2019, 'SAMPLE_USER', 'SAMPLE_PASS')
print(league)
First one will succeed, second throws the error. Worth noting that with the latest changes I still can successfully authenticate with the old swid method.
From your error message in the beginning it looks like you got past the username and password authentication and then it failed on _fetch_league. Was there any other messages printed to the console? If it fails the username and password it should print to the console.
No, no other message. Just what I copied over here.
I suppose if thats the case its failing on https://github.com/cwendt94/ff-espn-api/blob/660ef8b3a98fad03e1bebcaf1375a57a52b4af23/ff_espn_api/league.py#L66 ... so not auth, but API key? It seems like you're right and I've already authenticated and it isn't allowing me to make the request. This works fine for you, right?
I guess what's weird about this to me is that theoretically the API access and authentication are decoupled, so Its really strange that with one auth method I get in fine and the other I wind up being rejected by the API. I feel like there must be something in the latest version thats bugged somehow but if you can use it successfully I'm a bit at a loss.
Yeah it does seem weird. When you initialize the League object are you writing out the input variables like League(league_id=123, year=2019, username=“username”, password=“pass”)
My little script which he was using did not input the variables that way. https://github.com/drippyer/ESPN_FF_Tool/blob/d80ce0ed744d1b24586043c19b75c1a52c28562b/espnTool.py#L40
interesting! I've got it working but it took a little messing around. I think the issue was simply that I had somehow not gotten the updated version of the library installed correctly. Basically I needed to python3 -m pip uninstall ff_espn_api
then python3 -m pip install ff_espn_api
but it appears to be working now...Sorry for the confusion! I'll close the issue out.
No worries! When the new authentication was put in I didn’t realize it switched the order of variables which could mess up programs that didn’t assign the variables in the constructor
Yeah, had this issue with https://github.com/dtcarls/fantasy_football_chat_bot/issues/64 a quick way to make it backwards compatible would be make the contructor
def __init__(self, league_id: int, year: int, espn_s2=None, swid=None, username=None, password=None)
instead of
def __init__(self, league_id: int, year: int, username=None, password=None, espn_s2=None, swid=None)
I'll submit a PR
I'll be setting specific variable assignments going forward just in case, thanks for the info!
Update
I'm not actually sure whats going on here, it seems to authenticate and then the request is rejected with a 401.