scraping-rtn 0.0.7__py3-none-any.whl → 0.0.7.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,7 @@ class RtnSingleTeamYear(object):
17
17
 
18
18
  def get_team_mapping(self, force_update=False):
19
19
  if force_update:
20
- get_data_from_api.clear_cache()
20
+ get_data_from_api.cache_clear()
21
21
 
22
22
  all_teams_data = get_data_from_api(endpoint='gymnasts2', suffix=str(self.year) + '/1').json()
23
23
  return {team['team_name']: team['id'] for team in all_teams_data['teams']}
@@ -40,7 +40,7 @@ class RtnSingleTeamYear(object):
40
40
  school_year_map = {'1': 'FR', '2': 'SO', '3': 'JR', '4': 'SR'}
41
41
 
42
42
  if force_update:
43
- get_data_from_api.clear_cache()
43
+ get_data_from_api.cache_clear()
44
44
 
45
45
  roster_data = get_data_from_api(endpoint='rostermain', suffix=str(self.year)+'/'+str(self.team_id)+'/1').json()
46
46
 
@@ -64,7 +64,7 @@ class RtnSingleTeamYear(object):
64
64
 
65
65
  def _get_raw_season_results(self, force_update=False):
66
66
  if force_update:
67
- get_data_from_api.clear_cache()
67
+ get_data_from_api.cache_clear()
68
68
 
69
69
  meets = get_data_from_api(endpoint='dashboard', suffix=str(self.year)+'/'+str(self.team_id)).json()
70
70
  name_map = {'team_id': 'Team ID', 'team_name': 'Team', 'meet_id': 'Team Meet ID',
@@ -123,7 +123,7 @@ class RtnSingleTeamYear(object):
123
123
  for meet_id in [data['Team Meet ID'] for data in self._raw_season_results if data['Meet Date'] <= datetime.now()]:
124
124
  try:
125
125
  if force_update:
126
- get_data_from_api.clear_cache()
126
+ get_data_from_api.cache_clear()
127
127
 
128
128
  meet_res = get_data_from_api(endpoint='meetresults', suffix=str(meet_id)).json()
129
129
  # This API call returns scores from all teams at this meet, not just this team. Need to pick out correct score
@@ -142,7 +142,7 @@ class RtnSingleTeamYear(object):
142
142
 
143
143
  def _team_event_scores_team_consistency(self, force_update=False):
144
144
  if force_update:
145
- get_data_from_api.clear_cache()
145
+ get_data_from_api.cache_clear()
146
146
 
147
147
  res = get_data_from_api(endpoint='teamConsistency', suffix=f'{self.year}/{self.team_id}').json()
148
148
  if len(res['labels']) == 0:
@@ -192,7 +192,7 @@ class RtnSingleTeamYear(object):
192
192
  for meet_id in [meet['Team Meet ID'] for meet in self._raw_schedule if meet['Meet Date'] <= datetime.now()]:
193
193
  try:
194
194
  if force_update:
195
- get_data_from_api.clear_cache()
195
+ get_data_from_api.cache_clear()
196
196
 
197
197
  meet_res = get_data_from_api(endpoint='meetresults', suffix=str(meet_id)).json()
198
198
  if len(meet_res) == 0 or len(meet_res['scores']) == 0 or len(meet_res['scores'][0]) == 0:
@@ -234,7 +234,7 @@ class RtnSingleTeamYear(object):
234
234
  for gymnast in self._raw_roster:
235
235
  try:
236
236
  if force_update:
237
- get_data_from_api.clear_cache()
237
+ get_data_from_api.cache_clear()
238
238
 
239
239
  res = get_data_from_api(endpoint='indConsistency', suffix=f"{self.year}/{gymnast['Gymnast ID']}").json()
240
240
  ind_consistency = [{'Meet Date': normalize_date(res['labels'][i][:7] + str(self.year), dt_format='%b-%d-%Y'),
@@ -274,7 +274,7 @@ class RtnSingleTeamYear(object):
274
274
  # 'maxaa': 'AA',
275
275
  'gid': 'Gymnast ID'}
276
276
  if force_update:
277
- get_data_from_api.clear_cache()
277
+ get_data_from_api.cache_clear()
278
278
 
279
279
  nqsData = get_data_from_api(endpoint='rostermain', suffix=f'{self.year}/{self.team_id}/4').json()
280
280
  ind_nqs = [{name_map[k]: round(float(v), 4) if k != 'gid' and v != '' else (np.nan if k != 'gid' else v)
@@ -290,7 +290,7 @@ class RtnSingleTeamYear(object):
290
290
  def _get_current_week(self, force_update=False):
291
291
  if not hasattr(self, 'week'):
292
292
  if force_update:
293
- get_data_from_api.clear_cache()
293
+ get_data_from_api.cache_clear()
294
294
 
295
295
  week_data = get_data_from_api(endpoint='currentweek', suffix=str(self.year)).json()
296
296
  return min(int(week_data['week']), int(week_data['max']))
@@ -303,7 +303,7 @@ class RtnSingleTeamYear(object):
303
303
  'usag': 'USAG', 'ave': 'Average', 'high': 'High', 'name': 'Team'}
304
304
 
305
305
  if force_update:
306
- get_data_from_api.clear_cache()
306
+ get_data_from_api.cache_clear()
307
307
 
308
308
  res = get_data_from_api(endpoint='results', suffix=f'{self.year}/{week}/{team_ind_map[team_vs_ind]}/{event_api_map[event]}').json()
309
309
  if team_vs_ind == 'ind':
scraping_rtn/__init__.py CHANGED
@@ -16,12 +16,12 @@ def roster(year, teams, include_hometowns=False, include_class=False, include_ev
16
16
  teams = validate_input(teams)
17
17
 
18
18
  all_rosters = []
19
- for team in teams:
19
+ for i, team in enumerate(teams):
20
20
  if verbose:
21
21
  print(f'Getting roster for {team} ', end='\r' if team != teams[-1] else None)
22
22
  rtn = RtnSingleTeamYear(year=year, team_name=team)
23
23
  res = rtn.get_roster(include_hometowns=include_hometowns, include_class=include_class,
24
- include_events=include_events, force_update=force_update)
24
+ include_events=include_events, force_update=force_update if i == 0 else False)
25
25
  if verbose and len(res) == 0:
26
26
  print(f'\tNo roster found for {team}')
27
27
  all_rosters.append(res)
@@ -34,11 +34,11 @@ def schedule(year, teams, verbose=False, force_update=False):
34
34
  teams = validate_input(teams)
35
35
 
36
36
  all_schedules = []
37
- for team in teams:
37
+ for i, team in enumerate(teams):
38
38
  if verbose:
39
39
  print(f'Getting schedule for {team} ', end='\r' if team != teams[-1] else None)
40
40
  rtn = RtnSingleTeamYear(year=year, team_name=team)
41
- res = rtn.get_schedule(force_update=force_update)
41
+ res = rtn.get_schedule(force_update=force_update if i == 0 else False)
42
42
  if verbose and len(res) == 0:
43
43
  print(f'\tNo schedule found for {team}')
44
44
  all_schedules.append(res)
@@ -50,11 +50,11 @@ def team_results(year, teams, method='team_consistency', force_update=False, ver
50
50
  teams = validate_input(teams)
51
51
 
52
52
  all_results = []
53
- for team in teams:
53
+ for i, team in enumerate(teams):
54
54
  if verbose:
55
55
  print(f'Getting schedule and results for {team} ', end='\r' if team != teams[-1] else None)
56
56
  rtn = RtnSingleTeamYear(year=year, team_name=team)
57
- res = rtn.get_team_scores(method=method, force_update=force_update)
57
+ res = rtn.get_team_scores(method=method, force_update=force_update if i == 0 else False)
58
58
  if verbose and len(res) == 0:
59
59
  print(f'\tNo schedule and results found for {team}')
60
60
  all_results.append(res)
@@ -66,11 +66,11 @@ def individual_results(year, teams, method='by_meet', force_update=False, verbos
66
66
  teams = validate_input(teams)
67
67
 
68
68
  all_scores = []
69
- for team in teams:
69
+ for i, team in enumerate(teams):
70
70
  if verbose:
71
71
  print(f'Getting scores for {team} ', end='\r' if team != teams[-1] else None)
72
72
  rtn = RtnSingleTeamYear(year=year, team_name=team)
73
- res = rtn.get_individual_scores(method=method, force_update=force_update)
73
+ res = rtn.get_individual_scores(method=method, force_update=force_update if i == 0 else False)
74
74
  if verbose and len(res) == 0:
75
75
  print(f'\tNo scores found for {team}')
76
76
  all_scores.append(res)
@@ -82,11 +82,11 @@ def individual_nqs(year, teams, verbose=False, force_update=False):
82
82
  teams = validate_input(teams)
83
83
 
84
84
  all_nqs = []
85
- for team in teams:
85
+ for i, team in enumerate(teams):
86
86
  if verbose:
87
87
  print(f'Getting individual NQS for {team} ', end='\r' if team != teams[-1] else None)
88
88
  rtn = RtnSingleTeamYear(year=year, team_name=team)
89
- res = rtn.get_individual_nqs(force_update=force_update)
89
+ res = rtn.get_individual_nqs(force_update=force_update if i == 0 else False)
90
90
  if verbose and len(res) == 0:
91
91
  print(f'\tNo individual NQS found for {team}')
92
92
  all_nqs.append(res)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: scraping_rtn
3
- Version: 0.0.7
3
+ Version: 0.0.7.2
4
4
  Summary: package to scrape gymnastics data from Road To Nationals
5
5
  Author-email: Claire Harmon <ceharmon220@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/cgn-charmon/scraping_rtn
@@ -0,0 +1,8 @@
1
+ scraping_rtn/RtnSingleTeamYear.py,sha256=04vdtfmw7eEGl6h-Jb0DykqlbNX6bRcY8cs0SbAsv0I,18435
2
+ scraping_rtn/__init__.py,sha256=zA0jJ8U3MkMfLtnaWo-dcVvzrPpISLQlC62ZAJ1pm74,4230
3
+ scraping_rtn/src.py,sha256=vKWqCi9tfsJC1Di2uzHm_w0xk4ooTuzXrYtUSXG5TrI,24003
4
+ scraping_rtn-0.0.7.2.dist-info/LICENSE,sha256=hbUs8BYJhECMTIKtiPtjcfq-0fWEtLTxB42IS_SzxWk,1069
5
+ scraping_rtn-0.0.7.2.dist-info/METADATA,sha256=UxuqMAobTGB4w1d5Iya7qlp4fEmYoYzHYK3xyesNSJw,669
6
+ scraping_rtn-0.0.7.2.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
7
+ scraping_rtn-0.0.7.2.dist-info/top_level.txt,sha256=PlP9g-4WmuusQ1B-LmteQpLp-jVJdnh0BX8qAzBqDEE,13
8
+ scraping_rtn-0.0.7.2.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- scraping_rtn/RtnSingleTeamYear.py,sha256=gxjoC5agltKHPvjh4g5GyNNojRsOZ5kTS_iw8sB0uQ8,18435
2
- scraping_rtn/__init__.py,sha256=RWz-VwgQ2qwdJaC43J_tXrnIsgbtMgGw_k2Xoby4l9M,4055
3
- scraping_rtn/src.py,sha256=vKWqCi9tfsJC1Di2uzHm_w0xk4ooTuzXrYtUSXG5TrI,24003
4
- scraping_rtn-0.0.7.dist-info/LICENSE,sha256=hbUs8BYJhECMTIKtiPtjcfq-0fWEtLTxB42IS_SzxWk,1069
5
- scraping_rtn-0.0.7.dist-info/METADATA,sha256=p3qSUy81adYgaIpK4v2_8WFD7j0jAbDgnBgVXCIw6sw,667
6
- scraping_rtn-0.0.7.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
7
- scraping_rtn-0.0.7.dist-info/top_level.txt,sha256=PlP9g-4WmuusQ1B-LmteQpLp-jVJdnh0BX8qAzBqDEE,13
8
- scraping_rtn-0.0.7.dist-info/RECORD,,