Spaces:
Sleeping
Sleeping
James McCool
commited on
Commit
·
6669fad
1
Parent(s):
7ea6b9f
Refactor API endpoints in app.py to use updated expert rankings URLs and streamline tab structure by removing unused tabs.
Browse files
app.py
CHANGED
|
@@ -29,33 +29,29 @@ credentials = {
|
|
| 29 |
|
| 30 |
gc = gspread.service_account_from_dict(credentials)
|
| 31 |
|
| 32 |
-
traderater = "https://
|
| 33 |
|
| 34 |
-
ros_james_url = "https://
|
| 35 |
|
| 36 |
-
dwain_url = "https://
|
| 37 |
-
freedman_url = "https://
|
| 38 |
-
agg_url = "https://
|
| 39 |
|
| 40 |
-
weekly_dwain_url = "https://
|
| 41 |
-
weekly_freedman_url = "https://
|
| 42 |
-
weekly_agg_url = "https://
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
dev_agg_url = "https://fantasylife.dev.spotlightsportsb2b.com/api/projections/v1/nfl/aggregate/season/update"
|
| 47 |
-
|
| 48 |
-
freedman_nfl_game_model = "https://www.fantasylife.com/api/projections/v1/nfl-odds/james/game/update"
|
| 49 |
-
thor_ncaaf_game_model = "https://www.fantasylife.com/api/projections/v1/ncaafb-odds/james/game/update"
|
| 50 |
|
| 51 |
NCAAF_model_url = st.secrets['NCAAF_model_url']
|
| 52 |
pff_url = st.secrets['pff_url']
|
| 53 |
|
| 54 |
headers = {
|
| 55 |
-
'Authorization':
|
| 56 |
}
|
| 57 |
|
| 58 |
-
tab1, tab2, tab3, tab4, tab5
|
| 59 |
|
| 60 |
with tab1:
|
| 61 |
with st.container():
|
|
@@ -80,30 +76,8 @@ with tab1:
|
|
| 80 |
if response.status_code == 200:
|
| 81 |
st.write("Uploading!")
|
| 82 |
|
| 83 |
-
with tab2:
|
| 84 |
-
with st.container():
|
| 85 |
-
col1, col2, col3 = st.columns([3, 3, 3])
|
| 86 |
-
|
| 87 |
-
with col1:
|
| 88 |
-
st.info("Update Dwain's DEV SITE FantasyLife Season Long Projections")
|
| 89 |
-
if st.button("Dwain Projection Update (Dev Seasonal)", key='reset4'):
|
| 90 |
-
response = requests.post(dev_dwain_url, headers=headers)
|
| 91 |
-
if response.status_code == 200:
|
| 92 |
-
st.write("Uploading!")
|
| 93 |
-
with col2:
|
| 94 |
-
st.info("Update Freedman's DEV SITE FantasyLife Season Long Projections")
|
| 95 |
-
if st.button("Freedman Projection Update (Dev Seasonal)", key='reset5'):
|
| 96 |
-
response = requests.post(dev_freedman_url, headers=headers)
|
| 97 |
-
if response.status_code == 200:
|
| 98 |
-
st.write("Uploading!")
|
| 99 |
-
with col3:
|
| 100 |
-
st.info("Update the Aggregate DEV SITE FantasyLife Season Long Projections")
|
| 101 |
-
if st.button("Aggregate Projection Update (Dev Seasonal)", key='reset6'):
|
| 102 |
-
response = requests.post(dev_agg_url, headers=headers)
|
| 103 |
-
if response.status_code == 200:
|
| 104 |
-
st.write("Uploading!")
|
| 105 |
|
| 106 |
-
with
|
| 107 |
with st.container():
|
| 108 |
col1, col2, col3 = st.columns([3, 3, 3])
|
| 109 |
|
|
@@ -126,7 +100,7 @@ with tab3:
|
|
| 126 |
if response.status_code == 200:
|
| 127 |
st.write("Uploading!")
|
| 128 |
|
| 129 |
-
with
|
| 130 |
with st.container():
|
| 131 |
col1, col2, col3 = st.columns([3, 3, 3])
|
| 132 |
|
|
@@ -144,18 +118,7 @@ with tab4:
|
|
| 144 |
if response.status_code == 200:
|
| 145 |
st.write("Uploading!")
|
| 146 |
|
| 147 |
-
with
|
| 148 |
-
with st.container():
|
| 149 |
-
col1, col2, col3 = st.columns([3, 3, 3])
|
| 150 |
-
|
| 151 |
-
with col1:
|
| 152 |
-
st.info("Update FantasyLife Trade Rater")
|
| 153 |
-
if st.button("Projection Update (Trade Rater)", key='reset12'):
|
| 154 |
-
response = requests.post(traderater, headers=headers)
|
| 155 |
-
if response.status_code == 200:
|
| 156 |
-
st.write("Uploading!")
|
| 157 |
-
|
| 158 |
-
with tab6:
|
| 159 |
with st.container():
|
| 160 |
col1, col2, col3 = st.columns([3, 3, 3])
|
| 161 |
|
|
@@ -166,7 +129,7 @@ with tab6:
|
|
| 166 |
if response.status_code == 200:
|
| 167 |
st.write("Uploading!")
|
| 168 |
|
| 169 |
-
with
|
| 170 |
with st.container():
|
| 171 |
col1, col2, col3 = st.columns([3, 3, 3])
|
| 172 |
|
|
|
|
| 29 |
|
| 30 |
gc = gspread.service_account_from_dict(credentials)
|
| 31 |
|
| 32 |
+
traderater = "https://api.fantasylife.com/api/expert-rankings/v1/ratemytrade/seasonal/update"
|
| 33 |
|
| 34 |
+
ros_james_url = "https://api.fantasylife.com/api/expert-rankings/v1/james/ros/update"
|
| 35 |
|
| 36 |
+
dwain_url = "https://api.fantasylife.com/api/expert-rankings/v1/dwain/seasonal/update"
|
| 37 |
+
freedman_url = "https://api.fantasylife.com/api/expert-rankings/v1/freedman/seasonal/update"
|
| 38 |
+
agg_url = "https://api.fantasylife.com/api/expert-rankings/v1/aggregate/seasonal/update"
|
| 39 |
|
| 40 |
+
weekly_dwain_url = "https://api.fantasylife.com/api/expert-rankings/v1/dwain/weekly/update"
|
| 41 |
+
weekly_freedman_url = "https://api.fantasylife.com/api/expert-rankings/v1/freedman/weekly/update"
|
| 42 |
+
weekly_agg_url = "https://api.fantasylife.com/api/expert-rankings/v1/aggregate/weekly/update"
|
| 43 |
|
| 44 |
+
freedman_nfl_game_model = "https://www.fantasylife.com/api/projections/v1/nfl-odds/james/weekly/update"
|
| 45 |
+
thor_ncaaf_game_model = "https://www.fantasylife.com/api/projections/v1/ncaafb-odds/james/weekly/update"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
NCAAF_model_url = st.secrets['NCAAF_model_url']
|
| 48 |
pff_url = st.secrets['pff_url']
|
| 49 |
|
| 50 |
headers = {
|
| 51 |
+
'Authorization': 'Bearer 6984da1f-2c81-4140-8206-d018af38533f',
|
| 52 |
}
|
| 53 |
|
| 54 |
+
tab1, tab2, tab3, tab4, tab5 = st.tabs(['Seasonal', 'Weekly', 'Game Model', 'Rest of Season', 'NCAAF Script'])
|
| 55 |
|
| 56 |
with tab1:
|
| 57 |
with st.container():
|
|
|
|
| 76 |
if response.status_code == 200:
|
| 77 |
st.write("Uploading!")
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
+
with tab2:
|
| 81 |
with st.container():
|
| 82 |
col1, col2, col3 = st.columns([3, 3, 3])
|
| 83 |
|
|
|
|
| 100 |
if response.status_code == 200:
|
| 101 |
st.write("Uploading!")
|
| 102 |
|
| 103 |
+
with tab3:
|
| 104 |
with st.container():
|
| 105 |
col1, col2, col3 = st.columns([3, 3, 3])
|
| 106 |
|
|
|
|
| 118 |
if response.status_code == 200:
|
| 119 |
st.write("Uploading!")
|
| 120 |
|
| 121 |
+
with tab4:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
with st.container():
|
| 123 |
col1, col2, col3 = st.columns([3, 3, 3])
|
| 124 |
|
|
|
|
| 129 |
if response.status_code == 200:
|
| 130 |
st.write("Uploading!")
|
| 131 |
|
| 132 |
+
with tab5:
|
| 133 |
with st.container():
|
| 134 |
col1, col2, col3 = st.columns([3, 3, 3])
|
| 135 |
|