Remove port parameter
This commit is contained in:
@ -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()
|
||||
|
||||
@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user