dtsong / sleeper-api-wrapper

A Python API wrapper for Sleeper's API: https://docs.sleeper.app/
MIT License
61 stars 21 forks source link

Include User ID in get_standings() #35

Open JDIacobbo opened 9 months ago

JDIacobbo commented 9 months ago

I think it would be very helpful to include the user id along with the user name in the function get_standing(). In my league I am finding that team names tend to be changed often through out the season so mapping to the team name would break when this happens. The user ID of the owner is static and is more reliable to map. I've worked around this by mapping the user id to the team name each run but would prefer the id be included in the return of the function.

for user in users:
    user_id = user['user_id']
    team_name = user['metadata']['team_name']
    for id in group1:
        if id == user_id:
            group1[user_id] = team_name
    for id in group2:
        if id == user_id:
            group2[user_id] = team_name
    for id in group3:
        if id == user_id:
            group3[user_id] = team_name
    for id in group4:
        if id == user_id:
            group4[user_id] = team_name

for team in standings:
    for name in group1:
        if team[0] == group1[name]:
            ...
    for name in group2:
        if team[0] == group2[name]:
            ...
    for name in group3:
        if team[0] == group3[name]:
            ...
    for name in group4:
        if team[0] == group4[name]:
            ...