diff --git a/db.ipynb b/db.ipynb deleted file mode 100644 index b11c171..0000000 --- a/db.ipynb +++ /dev/null @@ -1,383 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [], - "source": [ - "import firebase_admin\n", - "from firebase_admin import db, credentials" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "metadata": {}, - "outputs": [], - "source": [ - "#firebase_admin.delete_app(firebase_admin.get_app())" - ] - }, - { - "cell_type": "code", - - "metadata": {}, - "outputs": [], - "source": [ - "from dotenv import load_dotenv\n", - "import os\n", - "load_dotenv()\n", - - "DATABASE_URL = os.getenv('DATABASE_URL')\n", - "CREDS = os.getenv('CREDS')" - ] - }, - { - "cell_type": "code", - - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "cred = credentials.Certificate(\"key.json\")\n", - "firebase_admin.initialize_app(cred, {\"databaseURL\": \"https://fantasy-contests-default-rtdb.firebaseio.com/\"})" - ] - }, - { - "cell_type": "code", - - "metadata": {}, - "outputs": [], - "source": [ - "\n", - "if not firebase_admin._apps:\n", - " cred = credentials.Certificate(CREDS)\n", - " firebase_admin.initialize_app(cred, {\n", - " 'databaseURL': DATABASE_URL\n", - " })" - ] - }, - { - "cell_type": "code", - - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "firebase_admin.get_app()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [] - }, - { - "cell_type": "code", - - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - - "ref = db.reference(\"/2023\")" - - ] - }, - { - "cell_type": "code", - - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - - "{'Week': 3,\n", - " 'contest': 'Most LB Points',\n", - " 'contest_results': [{'player1': {'game_played': 100,\n", - " 'name': 'Foyesade Oluokun',\n", - " 'score': 39.1},\n", - " 'player2': {'game_played': 100, 'name': 'Ernest Jones', 'score': 6.7},\n", - " 'rank': 1,\n", - " 'team': 'Lets Get Weird 🐸',\n", - " 'total_score': 45.800000000000004},\n", - " {'player1': {'game_played': 100, 'name': 'Bobby Okereke', 'score': 17.2},\n", - " 'player2': {'game_played': 100, 'name': 'Tremaine Edmunds', 'score': 20.6},\n", - " 'rank': 2,\n", - " 'team': 'You Hate to See That',\n", - " 'total_score': 37.8},\n", - " {'player1': {'game_played': 100, 'name': 'Bobby Wagner', 'score': 11.7},\n", - " 'player2': {'game_played': 100, 'name': 'Fred Warner', 'score': 22.4},\n", - " 'rank': 3,\n", - " 'team': 'Ma heart Mahomes',\n", - " 'total_score': 34.099999999999994},\n", - " {'player1': {'game_played': 100, 'name': 'Kyzir White', 'score': 12.4},\n", - " 'player2': {'game_played': 100, 'name': 'Devin Lloyd', 'score': 17.6},\n", - " 'rank': 4,\n", - " 'team': \"You're being a Kyren\",\n", - " 'total_score': 30.0},\n", - " {'player1': {'game_played': 100, 'name': 'Roquan Smith', 'score': 12.3},\n", - " 'player2': {'game_played': 100, 'name': 'Alex Singleton', 'score': 16.9},\n", - " 'rank': 5,\n", - " 'team': 'Maxxy Pats',\n", - " 'total_score': 29.2},\n", - " {'player1': {'game_played': 100, 'name': 'Jordan Hicks', 'score': 14.0},\n", - " 'player2': {'game_played': 100, 'name': 'Dre Greenlaw', 'score': 13.4},\n", - " 'rank': 6,\n", - " 'team': 'Baby got Dak',\n", - " 'total_score': 27.4},\n", - " {'player1': {'game_played': 100, 'name': 'Terrel Bernard', 'score': 22.8},\n", - " 'player2': {'game_played': 100, 'name': 'Cody Barton', 'score': 1.4},\n", - " 'rank': 7,\n", - " 'team': 'I h8 justin',\n", - " 'total_score': 24.2},\n", - " {'player1': {'game_played': 100, 'name': 'Zaire Franklin', 'score': 14.8},\n", - " 'player2': {'game_played': 100, 'name': 'Patrick Queen', 'score': 7.0},\n", - " 'rank': 8,\n", - " 'team': '- CircleKirk',\n", - " 'total_score': 21.8},\n", - " {'player1': {'game_played': 100, 'name': 'Quay Walker', 'score': 10.7},\n", - " 'player2': {'game_played': 100, 'name': 'Robert Spillane', 'score': 10.3},\n", - " 'rank': 9,\n", - " 'team': 'Justys Spilled Seed ',\n", - " 'total_score': 21.0},\n", - " {'player1': {'game_played': 100, 'name': 'T.J. Edwards', 'score': 2.8},\n", - " 'player2': {'game_played': 100, 'name': 'Pete Werner', 'score': 5.6},\n", - " 'rank': 10,\n", - " 'team': 'Punter? I Hardly Know Her',\n", - " 'total_score': 8.399999999999999}]}" - ] - }, - "execution_count": 13, - - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ref.get()" - ] - }, - { - "cell_type": "code", - - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - - "{'-NiFkEYRMyUnxkHJxjMZ': {'Week': 4,\n", - " 'contest': 'Most Kicker Points',\n", - " 'contest_results': [{'player1': {'game_played': 100,\n", - " 'name': 'Foyesade Oluokun',\n", - " 'score': 39.1},\n", - " 'player2': {'game_played': 100, 'name': 'Ernest Jones', 'score': 6.7},\n", - " 'rank': 1,\n", - " 'team': 'Lets Get Weird 🐸',\n", - " 'total_score': 45.800000000000004},\n", - " {'player1': {'game_played': 100, 'name': 'Bobby Okereke', 'score': 17.2},\n", - " 'player2': {'game_played': 100, 'name': 'Tremaine Edmunds', 'score': 20.6},\n", - " 'rank': 2,\n", - " 'team': 'You Hate to See That',\n", - " 'total_score': 37.8},\n", - " {'player1': {'game_played': 100, 'name': 'Bobby Wagner', 'score': 11.7},\n", - " 'player2': {'game_played': 100, 'name': 'Fred Warner', 'score': 22.4},\n", - " 'rank': 3,\n", - " 'team': 'Ma heart Mahomes',\n", - " 'total_score': 34.099999999999994},\n", - " {'player1': {'game_played': 100, 'name': 'Kyzir White', 'score': 12.4},\n", - " 'player2': {'game_played': 100, 'name': 'Devin Lloyd', 'score': 17.6},\n", - " 'rank': 4,\n", - " 'team': \"You're being a Kyren\",\n", - " 'total_score': 30.0},\n", - " {'player1': {'game_played': 100, 'name': 'Roquan Smith', 'score': 12.3},\n", - " 'player2': {'game_played': 100, 'name': 'Alex Singleton', 'score': 16.9},\n", - " 'rank': 5,\n", - " 'team': 'Maxxy Pats',\n", - " 'total_score': 29.2},\n", - " {'player1': {'game_played': 100, 'name': 'Jordan Hicks', 'score': 14.0},\n", - " 'player2': {'game_played': 100, 'name': 'Dre Greenlaw', 'score': 13.4},\n", - " 'rank': 6,\n", - " 'team': 'Baby got Dak',\n", - " 'total_score': 27.4},\n", - " {'player1': {'game_played': 100, 'name': 'Terrel Bernard', 'score': 22.8},\n", - " 'player2': {'game_played': 100, 'name': 'Cody Barton', 'score': 1.4},\n", - " 'rank': 7,\n", - " 'team': 'I h8 justin',\n", - " 'total_score': 24.2},\n", - " {'player1': {'game_played': 100, 'name': 'Zaire Franklin', 'score': 14.8},\n", - " 'player2': {'game_played': 100, 'name': 'Patrick Queen', 'score': 7.0},\n", - " 'rank': 8,\n", - " 'team': '- CircleKirk',\n", - " 'total_score': 21.8},\n", - " {'player1': {'game_played': 100, 'name': 'Quay Walker', 'score': 10.7},\n", - " 'player2': {'game_played': 100, 'name': 'Robert Spillane', 'score': 10.3},\n", - " 'rank': 9,\n", - " 'team': 'Justys Spilled Seed ',\n", - " 'total_score': 21.0},\n", - " {'player1': {'game_played': 100, 'name': 'T.J. Edwards', 'score': 2.8},\n", - " 'player2': {'game_played': 100, 'name': 'Pete Werner', 'score': 5.6},\n", - " 'rank': 10,\n", - " 'team': 'Punter? I Hardly Know Her',\n", - " 'total_score': 8.399999999999999}]},\n", - " 'Week': 3,\n", - " 'contest': 'Most LB Points',\n", - " 'contest_results': [{'player1': {'game_played': 100,\n", - " 'name': 'Foyesade Oluokun',\n", - " 'score': 39.1},\n", - " 'player2': {'game_played': 100, 'name': 'Ernest Jones', 'score': 6.7},\n", - " 'rank': 1,\n", - " 'team': 'Lets Get Weird 🐸',\n", - " 'total_score': 45.800000000000004},\n", - " {'player1': {'game_played': 100, 'name': 'Bobby Okereke', 'score': 17.2},\n", - " 'player2': {'game_played': 100, 'name': 'Tremaine Edmunds', 'score': 20.6},\n", - " 'rank': 2,\n", - " 'team': 'You Hate to See That',\n", - " 'total_score': 37.8},\n", - " {'player1': {'game_played': 100, 'name': 'Bobby Wagner', 'score': 11.7},\n", - " 'player2': {'game_played': 100, 'name': 'Fred Warner', 'score': 22.4},\n", - " 'rank': 3,\n", - " 'team': 'Ma heart Mahomes',\n", - " 'total_score': 34.099999999999994},\n", - " {'player1': {'game_played': 100, 'name': 'Kyzir White', 'score': 12.4},\n", - " 'player2': {'game_played': 100, 'name': 'Devin Lloyd', 'score': 17.6},\n", - " 'rank': 4,\n", - " 'team': \"You're being a Kyren\",\n", - " 'total_score': 30.0},\n", - " {'player1': {'game_played': 100, 'name': 'Roquan Smith', 'score': 12.3},\n", - " 'player2': {'game_played': 100, 'name': 'Alex Singleton', 'score': 16.9},\n", - " 'rank': 5,\n", - " 'team': 'Maxxy Pats',\n", - " 'total_score': 29.2},\n", - " {'player1': {'game_played': 100, 'name': 'Jordan Hicks', 'score': 14.0},\n", - " 'player2': {'game_played': 100, 'name': 'Dre Greenlaw', 'score': 13.4},\n", - " 'rank': 6,\n", - " 'team': 'Baby got Dak',\n", - " 'total_score': 27.4},\n", - " {'player1': {'game_played': 100, 'name': 'Terrel Bernard', 'score': 22.8},\n", - " 'player2': {'game_played': 100, 'name': 'Cody Barton', 'score': 1.4},\n", - " 'rank': 7,\n", - " 'team': 'I h8 justin',\n", - " 'total_score': 24.2},\n", - " {'player1': {'game_played': 100, 'name': 'Zaire Franklin', 'score': 14.8},\n", - " 'player2': {'game_played': 100, 'name': 'Patrick Queen', 'score': 7.0},\n", - " 'rank': 8,\n", - " 'team': '- CircleKirk',\n", - " 'total_score': 21.8},\n", - " {'player1': {'game_played': 100, 'name': 'Quay Walker', 'score': 10.7},\n", - " 'player2': {'game_played': 100, 'name': 'Robert Spillane', 'score': 10.3},\n", - " 'rank': 9,\n", - " 'team': 'Justys Spilled Seed ',\n", - " 'total_score': 21.0},\n", - " {'player1': {'game_played': 100, 'name': 'T.J. Edwards', 'score': 2.8},\n", - " 'player2': {'game_played': 100, 'name': 'Pete Werner', 'score': 5.6},\n", - " 'rank': 10,\n", - " 'team': 'Punter? I Hardly Know Her',\n", - " 'total_score': 8.399999999999999}]}" - ] - }, - "execution_count": 15, - - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - - "db.reference(\"/2023\").get()" - - ] - }, - { - "cell_type": "code", - - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ref.push({\n", - " \"Week_4\":\n", - " {\n", - " \"contest\": \"Most Kicker Points\",\n", - " \"contest_results\": [\n", - " {\n", - " \"players\":[{\n", - " \"game_played\": 100,\n", - " \"name\": \"Foyesade Oluokun\",\n", - " \"score\": 39.1\n", - " },\n", - " {\n", - " \"game_played\": 100,\n", - " \"name\": \"Ernest Jones\",\n", - " \"score\": 6.7\n", - " }],\n", - " \"rank\": 1,\n", - " \"team\": \"Lets Get Weird \\ud83d\\udc38\",\n", - " \"total_score\": 45.800000000000004\n", - " }\n", - " ]\n", - "}\n", - "})" - - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "venv", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.5" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -}