forked from sanchayshukla/bitzino
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun.py
110 lines (102 loc) · 4.12 KB
/
run.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
"""
Bitzino
"""
from flask import Flask, jsonify, request, send_from_directory
app = Flask(__name__)
@app.route('/blackjack', methods=['POST'])
def blackjack():
if request.method == 'POST':
utf8 = request.form.get('utf8')
print('utf8 = ' + utf8)
authenticity_token = request.form.get('authenticity_token')
print('authenticity_token = ' + authenticity_token)
sync_token = request.form.get('blackjack_table[sync_token]')
print('sync_token = ' + sync_token)
client_seed = request.form.get('blackjack_table[client_seed]')
print('client_seed = ' + client_seed)
bet = request.form.get('blackjack_table[bet]')
print('bet = ' + bet)
commit = request.form.get('commit')
print('commit = ' + commit)
# TODO
resp = jsonify(success=True)
resp.status_code = 200
return resp
# By default just send back game name (i.e. to GET request)
return 'blackjack'
@app.route('/video_poker', methods=['POST'])
def video_poker():
if request.method == 'POST':
utf8 = request.form.get('utf8')
print('utf8 = ' + utf8)
authenticity_token = request.form.get('authenticity_token')
print('authenticity_token = ' + authenticity_token)
sync_token = request.form.get('video_poker_table[sync_token]')
print('sync_token = ' + sync_token)
client_seed = request.form.get('video_poker_table[client_seed]')
print('client_seed = ' + client_seed)
bet = request.form.get('video_poker_table[bet]')
print('bet = ' + bet)
commit = request.form.get('commit')
print('commit = ' + commit)
# TODO
resp = jsonify(success=True)
resp.status_code = 200
return resp
# By default just send back game name (i.e. to GET request)
return 'video_poker'
@app.route('/craps', methods=['POST'])
def craps():
if request.method == 'POST':
utf8 = request.form.get('utf8')
print('utf8 = ' + utf8)
authenticity_token = request.form.get('authenticity_token')
print('authenticity_token = ' + authenticity_token)
sync_token = request.form.get('craps_table[sync_token]')
print('sync_token = ' + sync_token)
client_seed = request.form.get('craps_table[client_seed]')
print('client_seed = ' + client_seed)
wagers = request.form.get('craps_table[wagers]')
print('wagers = ' + wagers)
bet_per_click = request.form.get('craps_table[bet_per_click]')
print('bet_per_click = ' + bet_per_click)
commit = request.form.get('commit')
print('commit = ' + commit)
# TODO
resp = jsonify(success=True)
resp.status_code = 200
return resp
# By default just send back game name (i.e. to GET request)
return 'craps'
@app.route('/roulette', methods=['POST'])
def roulette():
if request.method == 'POST':
utf8 = request.form.get('utf8')
print('utf8 = ' + utf8)
authenticity_token = request.form.get('authenticity_token')
print('authenticity_token = ' + authenticity_token)
sync_token = request.form.get('roulette_table[sync_token]')
print('sync_token = ' + sync_token)
client_seed = request.form.get('roulette_table[client_seed]')
print('client_seed = ' + client_seed)
wagers = request.form.get('roulette_table[wagers]')
print('wagers = ' + wagers)
bet_per_click = request.form.get('roulette_table[bet_per_click]')
print('bet_per_click = ' + bet_per_click)
commit = request.form.get('commit')
print('commit = ' + commit)
# TODO
resp = jsonify(success=True)
resp.status_code = 200
return resp
# By default just send back game name (i.e. to GET request)
return 'roulette'
@app.route('/', defaults=dict(filename=None))
@app.route('/<path:filename>', methods=['GET', 'POST'])
def index(filename):
filename = filename or 'index.html'
if request.method == 'GET':
return send_from_directory('./bitzino.com', filename)
return jsonify(request.data)
if __name__ == '__main__':
app.run(debug=1)