Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cbiering committed Dec 20, 2024
1 parent e13d600 commit bbff5db
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion examples/01_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


async def main():
nova = Nova(host="172.30.0.135")
nova = Nova()
cell = nova.cell()
controllers = await cell.controllers()
controller = controllers[0]
Expand Down
6 changes: 2 additions & 4 deletions nova/core/nova.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(
version=version,
)

def cell(self, cell_id: str = config("CELL_NAME", "cell")) -> "Cell":
def cell(self, cell_id: str = config("CELL_NAME", default="cell")) -> "Cell":
return Cell(self._api_client, cell_id)


Expand All @@ -46,9 +46,7 @@ async def controllers(self) -> list["Controller"]:

async def controller(self, controller_host: str = None) -> "Controller":
controllers = await self._get_controllers()
found_controller = next(
(c for c in controllers if c.host == controller_host), None
)
found_controller = next((c for c in controllers if c.host == controller_host), None)

if found_controller is None:
raise ControllerNotFoundException(controller=controller_host)
Expand Down
13 changes: 6 additions & 7 deletions nova/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

T = TypeVar("T")

INTERNAL_CLUSTER_NOVA_API = "http://api-gateway.wandelbots.svc.cluster.local:8080"


def intercept(api_instance: T) -> T:
class Interceptor:
Expand Down Expand Up @@ -54,23 +56,20 @@ def sync_wrapper(*args, **kwargs):
return Interceptor(api_instance)


def _validate_host(host: str) -> str:
"""Remove any trailing slashes and validate scheme"""
_url = host.rstrip("/")
return _url

class ApiGateway:
def __init__(
self,
*,
host: str = "http://api-gateway.wandelbots.svc.cluster.local:8080",
host: str | None = None,
username: str | None = None,
password: str | None = None,
access_token: str | None = None,
version: str = "v1",
):
if host is None:
host = config("NOVA_API")
host = config("NOVA_API", default=INTERNAL_CLUSTER_NOVA_API)

print()

if username is None:
username = config("NOVA_USERNAME", default=None)
Expand Down

0 comments on commit bbff5db

Please sign in to comment.