finished api client implementation
added tests for api (compapi should run in the background or be installed)
This commit is contained in:
parent
c25715de40
commit
0e0a61d710
7 changed files with 162 additions and 16 deletions
|
@ -8,26 +8,38 @@ API_URL_GET_OP = API_URL + "getOp"
|
|||
API_URL_GET_GOAL = API_URL + "getGoal"
|
||||
API_URL_GET_ITEMS = API_URL + "getItems"
|
||||
|
||||
import json
|
||||
import os
|
||||
|
||||
API_URL = os.getenv("API_URL", "http://localhost:5000/") + "api/"
|
||||
API_URL_GET_POS = API_URL + "getPos"
|
||||
API_URL_GET_OP = API_URL + "getOp"
|
||||
API_URL_GET_GOAL = API_URL + "getGoal"
|
||||
API_URL_GET_ITEMS = API_URL + "getItems"
|
||||
API_URL_GET_PARK = API_URL + "getPark"
|
||||
API_URL_PAY_PARK = API_URL + "payPark"
|
||||
API_URL_SIMON_SAYS = API_URL + "simonSays"
|
||||
|
||||
|
||||
class Seeding:
|
||||
@staticmethod
|
||||
def get_park():
|
||||
pass
|
||||
def get_park() -> int:
|
||||
return json.loads(requests.get(API_URL_GET_PARK).content)["id"]
|
||||
|
||||
@staticmethod
|
||||
def pay_park():
|
||||
pass
|
||||
def pay_park() -> bool:
|
||||
return requests.get(API_URL_PAY_PARK).status_code == 200
|
||||
|
||||
@staticmethod
|
||||
def simon_says():
|
||||
pass
|
||||
def simon_says() -> int:
|
||||
return json.loads(requests.get(API_URL_SIMON_SAYS).content)["id"]
|
||||
|
||||
|
||||
class Position:
|
||||
def __init__(self, x, y, rotation):
|
||||
def __init__(self, x, y, degrees):
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.rotation = rotation
|
||||
self.degrees = degrees
|
||||
|
||||
|
||||
class DoubleElim:
|
||||
|
|
Reference in a new issue