server: add method to get individual app args

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2024-01-03 12:49:10 -05:00
parent 088a7e4e70
commit d6c8d6d3a6
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
1 changed files with 6 additions and 0 deletions

View File

@ -132,6 +132,12 @@ class Server:
def get_app_args(self) -> Dict[str, Any]:
return dict(self.app_args)
def get_app_arg(self, key: str, default=Sentinel.MISSING) -> Any:
val = self.app_args.get(key, default)
if val is Sentinel.MISSING:
raise KeyError(f"No key '{key}' in Application Arguments")
return val
def get_event_loop(self) -> EventLoop:
return self.event_loop