fix: added 'url' function
This commit is contained in:
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
[project]
|
[project]
|
||||||
name = "common"
|
name = "common"
|
||||||
description = "Reusable code stubs"
|
description = "Reusable code stubs"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.13"
|
||||||
authors = [
|
authors = [
|
||||||
{ name="BreakerBear", email="breakerbear@autistic.men" },
|
{ name="BreakerBear", email="breakerbear@autistic.men" },
|
||||||
|
|||||||
@@ -148,7 +148,12 @@ def define(method: str, handler: Callable[..., Any]):
|
|||||||
def remove(method: str) -> Callable[..., Any]:
|
def remove(method: str) -> Callable[..., Any]:
|
||||||
return handlers.pop(method)
|
return handlers.pop(method)
|
||||||
|
|
||||||
def run(logger: logging.Logger) -> str:
|
def url():
|
||||||
|
if server is None: return None
|
||||||
|
endpoint = server.listeners[0]
|
||||||
|
return f'ws://{endpoint.address}:{endpoint.port}'
|
||||||
|
|
||||||
|
def run(logger: logging.Logger):
|
||||||
history = History()
|
history = History()
|
||||||
fmt = logger.handlers[0].formatter
|
fmt = logger.handlers[0].formatter
|
||||||
logger.addHandler(history)
|
logger.addHandler(history)
|
||||||
@@ -156,6 +161,3 @@ def run(logger: logging.Logger) -> str:
|
|||||||
|
|
||||||
thread = Thread(target=lambda: trio.run(backend), daemon=True)
|
thread = Thread(target=lambda: trio.run(backend), daemon=True)
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
endpoint = server.listeners[0]
|
|
||||||
return f'ws://{endpoint.address}:{endpoint.port}'
|
|
||||||
|
|||||||
Reference in New Issue
Block a user