Download src/database.py from TrueDFS/NFL_DFS_Range_Of_Outcomes_Origin: direct link, hf CLI and curl.
- Browser
- Download file 429 Bytes
-
https://huggingface.co/spaces/TrueDFS/NFL_DFS_Range_Of_Outcomes_Origin/resolve/main/src/database.py
- Command line
-
hf download hf://spaces/TrueDFS/NFL_DFS_Range_Of_Outcomes_Origin/src/database.py
-
curl -L -o database.py https://huggingface.co/spaces/TrueDFS/NFL_DFS_Range_Of_Outcomes_Origin/resolve/main/src/database.py
429 Bytes
| import streamlit as st | |
| import pymongo | |
| import os | |
| def init_conn(): | |
| # Try to get from environment variable first, fall back to secrets | |
| uri = os.getenv('MONGO_URI') | |
| if not uri: | |
| uri = st.secrets['mongo_uri'] | |
| client = pymongo.MongoClient(uri, retryWrites=True, serverSelectionTimeoutMS=500000) | |
| db = client["NFL_Database"] | |
| return db | |
| db = init_conn() |