diff --git a/javascript/demo.js b/javascript/demo.js index 84c2e9c..1761e6f 100644 --- a/javascript/demo.js +++ b/javascript/demo.js @@ -1,12 +1,11 @@ const sdk = require("./fh_sdk"); -const FAIRHOPPER_HOST = "http://127.0.0.1"; -const FAIRHOPPER_PORT = 8010; +const FAIRHOPPER_HOST = "https://api.fairhopper.mjerenja.com"; async function main() { - const fh = new sdk.FairHopper(FAIRHOPPER_HOST, FAIRHOPPER_PORT); + const fh = new sdk.FairHopper(FAIRHOPPER_HOST); - console.log(`Pinging FairHopper server on ${FAIRHOPPER_HOST}:${FAIRHOPPER_PORT}`); + console.log(`Pinging FairHopper server on ${FAIRHOPPER_HOST}`); const pingResult = await fh.ping(); console.log("Ping result:", pingResult); console.log(); diff --git a/javascript/fh_sdk.js b/javascript/fh_sdk.js index 09e849d..3da80b5 100644 --- a/javascript/fh_sdk.js +++ b/javascript/fh_sdk.js @@ -36,9 +36,8 @@ const Direction = { }; class FairHopper { - constructor(host, port) { + constructor(host) { this.host = host; - this.port = port; this.defaultHeaders = { Accept: "application/json", @@ -47,7 +46,7 @@ class FairHopper { } formatUrl(path) { - return `${this.host}:${this.port}${path}`; + return `${this.host}${path}`; } async ping() { diff --git a/python/demo.py b/python/demo.py index b8ba577..363f2c7 100644 --- a/python/demo.py +++ b/python/demo.py @@ -1,13 +1,12 @@ from fh_sdk import Direction, FairHopper, PositionError -FAIRHOPPER_HOST = "http://127.0.0.1" -FAIRHOPPER_PORT = 8010 +FAIRHOPPER_HOST = "https://api.fairhopper.mjerenja.com" def main() -> None: - fh = FairHopper(FAIRHOPPER_HOST, FAIRHOPPER_PORT) + fh = FairHopper(FAIRHOPPER_HOST) - print(f"Pinging FairHopper server on {FAIRHOPPER_HOST}:{FAIRHOPPER_PORT}") + print(f"Pinging FairHopper server on {FAIRHOPPER_HOST}") res = fh.ping() print("Ping result:", res) print() diff --git a/python/fh_sdk.py b/python/fh_sdk.py index f7049f6..51e8eab 100644 --- a/python/fh_sdk.py +++ b/python/fh_sdk.py @@ -70,12 +70,11 @@ class GameInfoResponse(BaseModel): class FairHopper: - def __init__(self, host, port) -> None: + def __init__(self, host: str) -> None: self.host = host - self.port = port def format_url(self, path: str) -> str: - return f"{self.host}:{self.port}{path}" + return f"{self.host}{path}" def ping(self) -> PingResponse: r = requests.get(self.format_url("/ping"))