James McCool commited on
Commit
f147e97
·
1 Parent(s): 9cc55fb

Update contest data retrieval to handle 'GOLF' sport case

Browse files

- Modified the grab_contest_data function to correctly handle the 'GOLF' sport case by setting the sport variable to 'pga'.
- Ensured that the URL construction for contest data retrieval is consistent and accurate for both 'GOLF' and other sports.
- Maintained existing functionality while improving the robustness of the data retrieval process.

Files changed (1) hide show
  1. global_func/grab_contest_data.py +6 -2
global_func/grab_contest_data.py CHANGED
@@ -3,9 +3,13 @@ import requests
3
 
4
  def grab_contest_data(sport, contest_name, contest_id_map, contest_date, contest_date2):
5
 
 
 
 
 
6
  contest_id = contest_id_map[contest_name]
7
- raw_url = f'https://dh5nxc6yx3kwy.cloudfront.net/contests/{sport.lower()}/{contest_date}/{contest_id}/'
8
- raw_url2 = f'https://dh5nxc6yx3kwy.cloudfront.net/contests/{sport.lower()}/{contest_date2}/{contest_id}/'
9
 
10
  def format_lineup_string(lineup_hash, positions):
11
  """Replaces colons in a lineup hash with sequential positions."""
 
3
 
4
  def grab_contest_data(sport, contest_name, contest_id_map, contest_date, contest_date2):
5
 
6
+ if sport == 'GOLF':
7
+ sport_var = 'pga'
8
+ else:
9
+ sport_var = sport.lower()
10
  contest_id = contest_id_map[contest_name]
11
+ raw_url = f'https://dh5nxc6yx3kwy.cloudfront.net/contests/{sport_var}/{contest_date}/{contest_id}/'
12
+ raw_url2 = f'https://dh5nxc6yx3kwy.cloudfront.net/contests/{sport_var}/{contest_date2}/{contest_id}/'
13
 
14
  def format_lineup_string(lineup_hash, positions):
15
  """Replaces colons in a lineup hash with sequential positions."""