Skip to content

Commit

Permalink
Update functions.py
Browse files Browse the repository at this point in the history
Fixed the "Muggsy Bogues bug" by providing default values to player bio when it returns empty strings.
  • Loading branch information
Kudzmat authored Jan 24, 2025
1 parent db64f0c commit 32c5a42
Showing 1 changed file with 37 additions and 12 deletions.
49 changes: 37 additions & 12 deletions NoseBleedSeat/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,39 +303,64 @@ def get_player_bio(player_id):
player_data = player_bio['resultSets'][0]['rowSet'][0]

# college / high school
bio['education'] = player_data[8]
if player_data[8] == "":
bio['education'] = "N/A"
else:
bio['education'] = player_data[8]

# country
bio['country'] = player_data[9]
if player_data[9] == "":
bio['country'] = "N/A"
else:
bio['country'] = player_data[9]

# height
bio['height'] = player_data[11]
if player_data[11] == "":
bio['height'] = 00.00
else:
bio['height'] = player_data[11]

# weght
bio['weight'] = player_data[12]
# weight
if player_data[12] == "":
bio['weight'] = 00.00
else:
bio['weight'] = player_data[12]

# years
# bio['year'] = player_data[13]

# jersey number
bio['number'] = player_data[14]
if player_data[14] == "":
bio['number'] = 0
else:
bio['number'] = player_data[14]

# position
bio['position'] = player_data[15]
if player_data[15] == "":
bio['position'] = "N/A"
else:
bio['position'] = player_data[15]

# play status
bio['status'] = player_data[16]
status = bio['status']
if player_data[16] == "":
bio['status'] = "N/A"
else:
bio['status'] = player_data[16]

# team
bio['team'] = player_data[19]
if player_data[19] == "":
bio['team'] = "N/A"
else:
bio['team'] = player_data[19]

# team id
bio['team_id'] = int(player_data[18])
if player_data[18] == "":
bio['team_id'] = 1610612752 # putting Knicks as the default id so that players can have an orange background
else:
bio['team_id'] = int(player_data[18])

return bio


def get_accolades(player_id):
# Construct the proxy URL
proxy_url = f"http://{SMARTPROXY_USERNAME}:{SMARTPROXY_PASSWORD}@gate.smartproxy.com:10001"
Expand Down

0 comments on commit 32c5a42

Please sign in to comment.