-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_data.py
More file actions
23 lines (19 loc) · 761 Bytes
/
Copy pathget_data.py
File metadata and controls
23 lines (19 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import pandas as pd
import streamlit as st
import requests as r
@st.cache_data(ttl=90)
def data ():
df = pd.read_csv("mongo_export.csv")
return df
@st.cache_data(ttl=90)
def get_tba_data(event_code, tba_key):
matches = r.get(f"https://www.thebluealliance.com/api/v3/event/{event_code}/matches/simple", headers={"X-TBA-Auth-Key": tba_key}).json()
oprs = r.get(f"https://www.thebluealliance.com/api/v3/event/{event_code}/oprs", headers={"X-TBA-Auth-Key": tba_key}).json()
coprs = r.get(f"https://www.thebluealliance.com/api/v3/event/{event_code}/coprs", headers={"X-TBA-Auth-Key": tba_key}).json()
stats = dict()
stats.update(oprs)
stats.update(coprs)
return {
"matches": matches,
"stats": stats
}