Hello, I'm developing an application to gather the data of a league that I have, dynasty format, to facilitate the control of salaries, free agent and etc.
Starting by working with the 'get_all_players()' method, so that we can make a relationship with the team's players and whoever is not on a team, we will consider it as a free agent. It hasn't been put into practice yet haha
Having to do the data processing of this return, the api returns the coachs and defense teams, so I thought of “upgrading” the method, I've never done a PR in third-party code, so just commenting on it, the idea was with that, what do you think?
def get_all_players(self, type="all"):
r = self._call("https://api.sleeper.app/v1/players/nfl")
r_non_players = {_:r[_] for _ in r if r[_]['position'] == None}
r_def_players = {_:r[_] for _ in r if r[_]['position'] == 'DEF'}
r_only_players = {_:r[_] for _ in r if r[_]['position'] != None\
and r[_]['position'] != "DEF"}
player_type = {'all':r,
'only_players':r_only_players,
'def_players':r_def_players,
'non_players':r_non_players}
return player_type[type]
I don't know how this would be in terms of performance and if it's within the pep8 standard, if it's positive and makes sense, think about filtering by positions too.
That's it, thanks for your attention, guys. #GoGiants
IMO this is a good idea, though I think it might be tough to also filter by position. I've done something similar with my own projects using the package.
Hello, I'm developing an application to gather the data of a league that I have, dynasty format, to facilitate the control of salaries, free agent and etc.
Starting by working with the 'get_all_players()' method, so that we can make a relationship with the team's players and whoever is not on a team, we will consider it as a free agent. It hasn't been put into practice yet haha
Having to do the data processing of this return, the api returns the coachs and defense teams, so I thought of “upgrading” the method, I've never done a PR in third-party code, so just commenting on it, the idea was with that, what do you think?
I don't know how this would be in terms of performance and if it's within the pep8 standard, if it's positive and makes sense, think about filtering by positions too.
That's it, thanks for your attention, guys. #GoGiants