-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpredictor.py
30 lines (18 loc) · 831 Bytes
/
predictor.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
import requests
import os
class LaLigaPredictor():
HTTPS = 'https://'
DOMAIN = os.environ['PREDICTOR_DOMAIN'] + '/prod'
ROUTE_PREDICT = '/predict-points'
def __init__(self) -> None:
pass
def get_prediction(self, id, team_id, cum_totalPoints, cumavg_totalPoints, curr_match_as_local, curr_match_opponent_id):
params = '?' + '&'.join([
f'id={id}',
f'team_id={team_id}',
f'cum_totalPoints={cum_totalPoints}',
f'cumavg_totalPoints={cumavg_totalPoints}',
f'curr_match_as_local={curr_match_as_local}',
f'curr_match_opponent_id={curr_match_opponent_id}'])
response = requests.get(f'{self.HTTPS}{self.DOMAIN}{self.ROUTE_PREDICT}{params}')
return response.json()