Skip to content

Commit

Permalink
new branch
Browse files Browse the repository at this point in the history
  • Loading branch information
justin-hsieh committed Oct 30, 2023
1 parent d0298c6 commit c2fdbae
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,5 @@ venv.bak/
.gitmodules

.vscode
key.json
.ipynb
7 changes: 7 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# Third-party imports
from flask import Flask, jsonify, request
import json

from flask_cors import CORS, cross_origin
# from decouple import config
from fantasy_app.functions import get_current_matchups, current_week, get_most_position_points, order_positions_by_points
from fantasy_app.contest_list import contests
import firebase_admin
from firebase_admin import credentials, db


cred = credentials.Certificate("./key.json")
firebase_admin.initialize_app(cred)


# app.config['SQLALCHEMY_DATABASE_URI'] = config('DATABASE_URL')
Expand Down
133 changes: 133 additions & 0 deletions db.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 15,
"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",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"cred = credentials.Certificate(\"key.json\")\n",
"firebase_admin.initialize_app(cred, {\"databaseURL\": \"https://fantasy-contests-default-rtdb.firebaseio.com/\"})"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [],
"source": [
"if not firebase_admin._apps:\n",
" firebase_admin.initialize_app(cred, {\n",
" 'databaseURL': 'https://fantasy-contests-default-rtdb.firebaseio.com/'\n",
" })"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"firebase_admin.get_app()"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [],
"source": [
"ref = db.reference(\"/\")"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'name': 'JJ'}"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ref.get()"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'JJ'"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"db.reference(\"/name\").get()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"db.reference(\"/name\").set('Justy')"
]
}
],
"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
}
13 changes: 13 additions & 0 deletions key.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"type": "service_account",
"project_id": "fantasy-contests",
"private_key_id": "666c2a25326a1a0d4026e850e881eb9f399ab6fc",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCulw7bps+GQB3w\n4GS130M0YwNi0YgI2gvZ/JZy1HrweSgP9ZCaiKNgEgRZPvhhMfol+qEirEpnI6Z6\nfTudyl5dxVMlVjfbcRIu06CnQdkKFz/OYeB9J+FlwnsywJMgUeZTJFhYckPnH4zu\noa+FFfH50c627uenhM4Jd1DuLMJzhf/VnL8szNnr//RofHtrs2mDBhKFUy+GfNWy\nFaPiBo2XXP/6sV1LBh3b0TWSGTZDx0lwF55uzS58PjHzw9yPlyySMsUSv9tmpACe\n65N8eiixcx7niAN8ig3toDa6afRsSFC8bVwRnNK5s9YMAYA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7SaBnUSL9CL7yB98BTd/k+GYMCgYBdsdPTW+Cwnnhcx7zh4A/E\nn6F3g1Iny9qjx+OnKFL2Q+gU4Wr1GYbSL5rwBFIED2cXNcBXnPtTsdJxN8iqxHB3\nkNpqw9SdJR2qverh1AlRbjBY2KgiCM5VqrhBUBWhiEXZ+LTAoW1gfTK9sWxY8yEI\nd9Tg26imYxeYfM4O8WwQFg==\n-----END PRIVATE KEY-----\n",
"client_email": "[email protected]",
"client_id": "118329157944890218182",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-atqc1%40fantasy-contests.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ colorama==0.4.5
coverage==6.4.4
dill==0.3.5.1
docopt==0.6.2
espn-api==0.21.0
espn-api==0.33.0
Flask==2.2.2
Flask-Cors==4.0.0
gunicorn==20.1.0
Expand Down

0 comments on commit c2fdbae

Please sign in to comment.