-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
38 lines (28 loc) · 1.11 KB
/
app.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
# import logging
from flask import Flask
from flask_ask import Ask, statement, question
import requests
# import pprint
apiKey = ''
app = Flask(__name__)
ask = Ask(app,"/")
# log = logging.getLogger()
# log.addHandler(logging.StreamHandler())
# log.setLevel(logging.DEBUG)
# logging.getLogger("flask_ask").setLevel(logging.DEBUG)
@ask.intent("MyNameIsIntent")
def my_name_is(firstname):
r = requests.get('https://fortnite.y3n.co/v2/player/' + firstname,
headers={'X-Key': apiKey}).json()
kills = r['br']['stats']['pc']['all']['kills']
kpd = r['br']['stats']['pc']['all']['kpd']
winR = r['br']['stats']['pc']['all']['winRate']
wins = r['br']['stats']['pc']['all']['wins']
# print(playerName + " has overall K.D.A " + str(kpd) + " winrate " + str(winR) + " and total Kills " + str(kills) + " and Wins are " + str(wins))
msg = str(firstname) + "has " + str(kills) + " and " + str(winR) + ". His total wins are " + str(wins)
# kpd=kpd, winR = winR, kills = kills, wins = wins)
return statement(msg)
if __name__ == '__main__':
app.run(debug=True)
# pp = pprint.PrettyPrinter(indent=4)
# pp.pprint()