-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.py
90 lines (69 loc) · 2.42 KB
/
api.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
from fastapi import FastAPI
from vlr import*
from news import*
from matches import*
from matchProcessor import*
from playerProcessor import*
app = FastAPI()
#matches.py-------------------------------------------
#getUpcomingAndLive
@app.get("/matches/getUpcomingAndLive/page:{page}")
async def getUpcomingAndLiveMatches(page):
return getUpcomingAndLive(page)
#getResults
@app.get("/matches/getResults/page:{page}")
async def getMatchResults(page):
return getResults(page)
#news.py----------------------------------------------
#getNews
@app.get("/getNews/page:{pageNum}")
async def getNewsPage(pageNum):
return getNews(pageNum)
#getArticle
@app.get("/getArticle/articleNum:{articleNum}")
async def getArticlePage(articleNum):
return getArticle(articleNum)
#matchProcessor.py------------------------------------
#getMatchStats
@app.get("/getMatchPage/{match_id}")
async def getMatch(match_id):
return getMatchPage(match_id)
#playerProcessor.py-----------------------------------
#getPlayerPage
@app.get("/getPlayerPage/{playerID}")
async def getPlayer(playerID):
return getPlayerPage(playerID)
#getPlayerAgentStats
@app.get("/getPlayerAgentStats/{playerID}/{timespan}")
async def getAgentStats(playerID, timespan):
return getPlayerAgentStats(playerID, timespan)
#getPlayerMatchResults
@app.get("/getPlayerMatchResults/{playerID}/{page}")
async def getPlayerResults(playerID, page):
return getPlayerMatchResults(playerID, page)
#Others-----------------------------------------------
#updateMatchDatabase
@app.get("/updateMatch")
async def updateMatchData():
updateMatchDatabase()
#searchMatchDatabase
@app.get("/searchMatch/team01:{team01}/team02:{team02}/event:{event}/date:{date}")
async def searchMatchData(team01, team02, event, date):
if(team01 == "?"):
team01 = None
if(team02 == "?"):
team02 = None
if(event == "?"):
event = None
if(date == "?"):
date = None
if(team01 == "?" and team02 == "?" and event == "?" and date == "?"):
return "Not Valid"
results = searchMatchDatabase(Team1 = team01, Team2 = team02, Event = event, Date = date)
results += searchMatchDatabase(Team1 = team02, Team2 = team01, Event = event, Date = date)
results = sorted(results, key=lambda x: x["Date"], reverse = True)
return results
#search
@app.get("/search/query:{query}/type:{type}")
async def searchVLR(query, type):
return search(query, type)