-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcommentatoryDataExtracter.py
52 lines (28 loc) · 1.15 KB
/
commentatoryDataExtracter.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
import requests
class API_USER :
URL = "https://cricbuzz-cricket.p.rapidapi.com/mcenter/v1/"
API_KEY = str()
HOST = "cricbuzz-cricket.p.rapidapi.com"
def __init__(self, key) :
self.API_KEY = key
self.header = {
"X-RapidAPI-Key": self.API_KEY,
"X-RapidAPI-Host": self.HOST
}
def __scoreCardUrl(self, matchID) :
return self.URL + str(matchID) + "/scard"
def __commentatoryURL(self, matchID) :
return self.URL + str(matchID) + "/comm"
def getScorecard(self, id) :
response = requests.request("GET",
self.__scoreCardUrl(matchID=id),
headers=self.header)
return response.text
def getCommentatory(self, id) :
response = requests.request("GET",
self.__commentatoryURL(matchID=id),
headers=self.header)
return response.text
if __name__ == "__main__":
user = API_USER("f6bfae9f81mshffe4d7e59696e55p194f70jsn129166b51d44")
print(user.getCommentatory(40381))