-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
93 lines (83 loc) · 3.99 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
from fastapi import FastAPI
import gspread
from oauth2client.service_account import ServiceAccountCredentials
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI()
origins = ["*"]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/organizing")
async def OCommittee():
# --------------------------------------------------------------------------------------
# SHEET SETUP
scope = ["https://spreadsheets.google.com/feeds",
"https://www.googleapis.com/auth/spreadsheets",
"https://www.googleapis.com/auth/drive.file",
"https://www.googleapis.com/auth/drive"]
credentials = ServiceAccountCredentials.from_json_keyfile_name('static/key/api.json', scope)
client = gspread.authorize(credentials)
sheet = client.open_by_key("1jGMF0OBt8x20C8eLX9u6Qx8sADyy870kLyxE0HO_U2g").sheet1
# --------------------------------------------------------------------------------------
x = sheet.col_values(1)
return x
@app.get("/steering")
async def SCommittee():
# --------------------------------------------------------------------------------------
# SHEET SETUP
scope = ["https://spreadsheets.google.com/feeds",
"https://www.googleapis.com/auth/spreadsheets",
"https://www.googleapis.com/auth/drive.file",
"https://www.googleapis.com/auth/drive"]
credentials = ServiceAccountCredentials.from_json_keyfile_name('static/key/api.json', scope)
client = gspread.authorize(credentials)
sheet = client.open_by_key("1jGMF0OBt8x20C8eLX9u6Qx8sADyy870kLyxE0HO_U2g").sheet1
# --------------------------------------------------------------------------------------
x = sheet.col_values(2)
return x
@app.get("/international")
async def ICommittee():
# --------------------------------------------------------------------------------------
# SHEET SETUP
scope = ["https://spreadsheets.google.com/feeds",
"https://www.googleapis.com/auth/spreadsheets",
"https://www.googleapis.com/auth/drive.file",
"https://www.googleapis.com/auth/drive"]
credentials = ServiceAccountCredentials.from_json_keyfile_name('static/key/api.json', scope)
client = gspread.authorize(credentials)
sheet = client.open_by_key("1jGMF0OBt8x20C8eLX9u6Qx8sADyy870kLyxE0HO_U2g").sheet1
# --------------------------------------------------------------------------------------
x = sheet.col_values(3)
return x
@app.get("/technical")
async def TCommittee():
# --------------------------------------------------------------------------------------
# SHEET SETUP
scope = ["https://spreadsheets.google.com/feeds",
"https://www.googleapis.com/auth/spreadsheets",
"https://www.googleapis.com/auth/drive.file",
"https://www.googleapis.com/auth/drive"]
credentials = ServiceAccountCredentials.from_json_keyfile_name('static/key/api.json', scope)
client = gspread.authorize(credentials)
sheet = client.open_by_key("1jGMF0OBt8x20C8eLX9u6Qx8sADyy870kLyxE0HO_U2g").sheet1
# --------------------------------------------------------------------------------------
x = sheet.col_values(5)
return x
@app.get("/national")
async def NCommittee():
# --------------------------------------------------------------------------------------
# SHEET SETUP
scope = ["https://spreadsheets.google.com/feeds",
"https://www.googleapis.com/auth/spreadsheets",
"https://www.googleapis.com/auth/drive.file",
"https://www.googleapis.com/auth/drive"]
credentials = ServiceAccountCredentials.from_json_keyfile_name('static/key/api.json', scope)
client = gspread.authorize(credentials)
sheet = client.open_by_key("1jGMF0OBt8x20C8eLX9u6Qx8sADyy870kLyxE0HO_U2g").sheet1
# --------------------------------------------------------------------------------------
x = sheet.col_values(4)
return x