-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.py
More file actions
35 lines (26 loc) · 1.09 KB
/
Client.py
File metadata and controls
35 lines (26 loc) · 1.09 KB
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
import requests
import json
class Client:
def __init__(self):
self.token = ''
pass
def setToken(self, token):
self.token = token
def game_list(self):
url = 'https://wordblitz-api-prod.lotum.com/v2/game/list?version=5.115.0&signature=' + self.token
x = requests.get(url)
return json.loads(x.text)
def start_game(self, gameId, round):
url = 'https://wordblitz-api-prod.lotum.com/v2/game/start?version=5.115.0&signature=' + self.token
form_data = {'duration': 80, 'gameId': gameId, 'round': round}
x = requests.post(url, data = form_data)
def play(self, gameId, round, paths):
url = 'https://wordblitz-api-prod.lotum.com' + '/v2/game/play?version=5.115.0&signature=' + self.token
print("path= " + str(paths))
words = []
for path in paths:
word = json.dumps({"p":path,"o":"u"})
words.append(word)
form_data = {'gameId': gameId, 'round': round, 'words': words}
x = requests.post(url, data = form_data)
print(x.text)