Skip to content

Commit

Permalink
Merge branch 'firebase' into fix_functions
Browse files Browse the repository at this point in the history
  • Loading branch information
justin-hsieh authored Nov 9, 2023
2 parents 62f7239 + 8d92079 commit 00d48fc
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,5 @@ venv.bak/

.vscode
key.json
.ipynb
.ipynb

61 changes: 42 additions & 19 deletions db.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,27 @@
},
{
"cell_type": "code",
"execution_count": 21,

"metadata": {},
"outputs": [],
"source": [
"from dotenv import load_dotenv\n",
"import os\n",
"load_dotenv()\n",
"DATABASE_URL = os.getenv('DATABASE_URL')"

"DATABASE_URL = os.getenv('DATABASE_URL')\n",
"CREDS = os.getenv('CREDS')"
]
},
{
"cell_type": "code",
"execution_count": 2,

"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<firebase_admin.App at 0x24da2f4c400>"
]
},
"execution_count": 2,

"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -54,28 +53,27 @@
},
{
"cell_type": "code",
"execution_count": 3,

"metadata": {},
"outputs": [],
"source": [
"\n",
"if not firebase_admin._apps:\n",
" cred = credentials.Certificate(CREDS)\n",
" firebase_admin.initialize_app(cred, {\n",
" 'databaseURL': 'https://fantasy-contests-default-rtdb.firebaseio.com/'\n",
" 'databaseURL': DATABASE_URL\n",
" })"
]
},
{
"cell_type": "code",
"execution_count": 4,

"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<firebase_admin.App at 0x24da2f4c400>"
]
},
"execution_count": 4,

"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -84,23 +82,42 @@
"firebase_admin.get_app()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": 12,

"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"<firebase_admin.db.Reference at 0x28feacfdc10>"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [

"ref = db.reference(\"/2023\")"

]
},
{
"cell_type": "code",
"execution_count": 13,

"metadata": {},
"outputs": [
{
"data": {
"text/plain": [

"{'Week': 3,\n",
" 'contest': 'Most LB Points',\n",
" 'contest_results': [{'player1': {'game_played': 100,\n",
Expand Down Expand Up @@ -158,6 +175,7 @@
]
},
"execution_count": 13,

"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -168,12 +186,13 @@
},
{
"cell_type": "code",
"execution_count": 15,

"metadata": {},
"outputs": [
{
"data": {
"text/plain": [

"{'-NiFkEYRMyUnxkHJxjMZ': {'Week': 4,\n",
" 'contest': 'Most Kicker Points',\n",
" 'contest_results': [{'player1': {'game_played': 100,\n",
Expand Down Expand Up @@ -285,17 +304,20 @@
]
},
"execution_count": 15,

"metadata": {},
"output_type": "execute_result"
}
],
"source": [

"db.reference(\"/2023\").get()"

]
},
{
"cell_type": "code",
"execution_count": 19,

"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -333,6 +355,7 @@
" ]\n",
"}\n",
"})"

]
}
],
Expand Down
1 change: 1 addition & 0 deletions fantasy_app/espn_api_submodule/espn_api/base_league.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def _fetch_league(self, SettingsClass=BaseSettings):
self.current_week = self.scoringPeriodId if self.scoringPeriodId <= data[
'status']['finalScoringPeriod'] else data['status']['finalScoringPeriod']
self.settings = SettingsClass(data['settings'])
self.members = data.get('members', [])
return data

def _fetch_teams(self, data, TeamClass, pro_schedule=None):
Expand Down

0 comments on commit 00d48fc

Please sign in to comment.