voxutils 0.7.4__tar.gz → 0.7.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {voxutils-0.7.4 → voxutils-0.7.6}/PKG-INFO +1 -1
- {voxutils-0.7.4 → voxutils-0.7.6}/pyproject.toml +1 -1
- {voxutils-0.7.4 → voxutils-0.7.6}/src/voxutils/abc.py +3 -3
- {voxutils-0.7.4 → voxutils-0.7.6}/src/voxutils/amiclient.py +1 -1
- {voxutils-0.7.4 → voxutils-0.7.6}/src/voxutils/asyncutils.py +2 -2
- {voxutils-0.7.4 → voxutils-0.7.6}/src/voxutils/config.py +41 -29
- {voxutils-0.7.4 → voxutils-0.7.6}/uv.lock +3 -2
- {voxutils-0.7.4 → voxutils-0.7.6}/.gitignore +0 -0
- {voxutils-0.7.4 → voxutils-0.7.6}/.python-version +0 -0
- {voxutils-0.7.4 → voxutils-0.7.6}/README.md +0 -0
- {voxutils-0.7.4 → voxutils-0.7.6}/src/voxutils/__init__.py +0 -0
- {voxutils-0.7.4 → voxutils-0.7.6}/src/voxutils/amqpclient.py +0 -0
- {voxutils-0.7.4 → voxutils-0.7.6}/src/voxutils/exceptions.py +0 -0
- {voxutils-0.7.4 → voxutils-0.7.6}/src/voxutils/httpclient.py +0 -0
- {voxutils-0.7.4 → voxutils-0.7.6}/src/voxutils/log.py +0 -0
- {voxutils-0.7.4 → voxutils-0.7.6}/src/voxutils/postgresdriver.py +0 -0
- {voxutils-0.7.4 → voxutils-0.7.6}/src/voxutils/py.typed +0 -0
- {voxutils-0.7.4 → voxutils-0.7.6}/src/voxutils/retrytimer.py +0 -0
- {voxutils-0.7.4 → voxutils-0.7.6}/src/voxutils/systemservice.py +0 -0
- {voxutils-0.7.4 → voxutils-0.7.6}/src/voxutils/types.py +0 -0
- {voxutils-0.7.4 → voxutils-0.7.6}/src/voxutils/utils.py +0 -0
- {voxutils-0.7.4 → voxutils-0.7.6}/tests/postgresdriver_test.py +0 -0
|
@@ -142,8 +142,8 @@ class TcpClient(Generic[T], Communicator[T]):
|
|
|
142
142
|
self.connect_attempted_event.set()
|
|
143
143
|
self._ready_event.set() # Inform anyone interested that the service is ready
|
|
144
144
|
# Wait until any task fails
|
|
145
|
-
done_tasks: set[Task[None]]
|
|
146
|
-
pending_tasks: set[Task[None]]
|
|
145
|
+
done_tasks: set[Task[None]]
|
|
146
|
+
pending_tasks: set[Task[None]]
|
|
147
147
|
done_tasks, pending_tasks = await wait(tasks, return_when=FIRST_COMPLETED)
|
|
148
148
|
task: Task[None]
|
|
149
149
|
for task in done_tasks:
|
|
@@ -232,7 +232,7 @@ class TcpClient(Generic[T], Communicator[T]):
|
|
|
232
232
|
self.logger.exception('Error while shutting down TCP connection', server=name)
|
|
233
233
|
self.logger.debug('Closed network connection to TCP server', server=name)
|
|
234
234
|
|
|
235
|
-
async def _end_task(self, task: Task[T]) -> None:
|
|
235
|
+
async def _end_task(self, task: Task[T | None]) -> None:
|
|
236
236
|
"""
|
|
237
237
|
Ends a top-level task after error or shutdown.
|
|
238
238
|
"""
|
|
@@ -159,7 +159,7 @@ class AmiClient(PbxClient[JsonDict]):
|
|
|
159
159
|
command: str = ''
|
|
160
160
|
for name, value in ami_action.items():
|
|
161
161
|
if isinstance(value, (list, tuple, set)):
|
|
162
|
-
subvalue:
|
|
162
|
+
subvalue: JsonValue
|
|
163
163
|
for subvalue in value:
|
|
164
164
|
command += f'{name}: {subvalue}\r\n'
|
|
165
165
|
else:
|
|
@@ -17,7 +17,7 @@ from asyncio import (
|
|
|
17
17
|
to_thread,
|
|
18
18
|
wait_for,
|
|
19
19
|
)
|
|
20
|
-
from collections.abc import Awaitable, Callable, Collection,
|
|
20
|
+
from collections.abc import Awaitable, Callable, Collection, Generator
|
|
21
21
|
from email import encoders
|
|
22
22
|
from email.header import Header
|
|
23
23
|
from email.mime.base import MIMEBase
|
|
@@ -217,7 +217,7 @@ async def send_email(
|
|
|
217
217
|
|
|
218
218
|
# Necessary due to pyroute2 - uvloop incompatibility
|
|
219
219
|
@contextlib.contextmanager
|
|
220
|
-
def _ip_route() ->
|
|
220
|
+
def _ip_route() -> Generator[IPRoute]:
|
|
221
221
|
loop = SelectorEventLoop(SelectSelector())
|
|
222
222
|
try:
|
|
223
223
|
with IPRoute(use_event_loop=loop) as ipr:
|
|
@@ -769,48 +769,60 @@ def load_db_config(conf_file_name: str, err_list: list[str]) -> DbConfig | None:
|
|
|
769
769
|
return DbConfig(**db_conf) # type: ignore # Already checked
|
|
770
770
|
|
|
771
771
|
|
|
772
|
+
def check_smtp_server(
|
|
773
|
+
name: str, server_conf: JsonValue, err_list: list[str]
|
|
774
|
+
) -> SmtpServerConfig | None:
|
|
775
|
+
desc: str = f'SMTP server {name}'
|
|
776
|
+
if not check_valid_dict(server_conf, desc, err_list):
|
|
777
|
+
return None
|
|
778
|
+
error_count: int = len(err_list)
|
|
779
|
+
for setting, value in server_conf.items():
|
|
780
|
+
if setting == 'host':
|
|
781
|
+
check_valid_host(value, desc, err_list)
|
|
782
|
+
elif setting == 'port':
|
|
783
|
+
check_valid_port(value, desc, err_list)
|
|
784
|
+
elif setting == 'user':
|
|
785
|
+
check_valid_string(value, desc + ' user', err_list)
|
|
786
|
+
elif setting == 'pswd':
|
|
787
|
+
check_valid_string(value, desc + ' password', err_list, True)
|
|
788
|
+
elif setting == 'ssl':
|
|
789
|
+
check_valid_bool(value, f'{desc} SSL value', err_list)
|
|
790
|
+
elif setting == 'tls':
|
|
791
|
+
check_valid_bool(value, f'{desc} TLS value', err_list)
|
|
792
|
+
elif setting == 'validate_certs':
|
|
793
|
+
check_valid_bool(value, f'{desc} validate certs', err_list)
|
|
794
|
+
else:
|
|
795
|
+
err_list.append(f'Unknown setting "{setting}" in {desc} section.')
|
|
796
|
+
if len(err_list) > error_count:
|
|
797
|
+
return None
|
|
798
|
+
return SmtpServerConfig(**server_conf)
|
|
799
|
+
|
|
800
|
+
|
|
772
801
|
def load_email_config(
|
|
773
|
-
conf_file_name: str,err_list: list[str]
|
|
802
|
+
conf_file_name: str, err_list: list[str]
|
|
774
803
|
) -> dict[str, SmtpServerConfig] | None:
|
|
775
804
|
with open(conf_file_name, 'rb') as conf_file:
|
|
776
805
|
config: JsonDict = tomli.load(conf_file)
|
|
777
806
|
error_count: int = len(err_list)
|
|
778
807
|
section_name: str = 'smtp_servers'
|
|
808
|
+
smtp_servers: dict[str, SmtpServerConfig] = {}
|
|
779
809
|
for setting, value in config.items():
|
|
780
810
|
if setting == section_name:
|
|
781
811
|
if check_valid_dict(value, 'SMTP servers', err_list):
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
elif subsetting == 'user':
|
|
791
|
-
check_valid_string(subvalue, desc + ' user', err_list)
|
|
792
|
-
elif subsetting == 'pswd':
|
|
793
|
-
check_valid_string(subvalue, desc + ' password', err_list, True)
|
|
794
|
-
elif subsetting == 'ssl':
|
|
795
|
-
check_valid_bool(subvalue, f'{desc} SSL value', err_list)
|
|
796
|
-
elif subsetting == 'tls':
|
|
797
|
-
check_valid_bool(subvalue, f'{desc} TLS value', err_list)
|
|
798
|
-
elif subsetting == 'validate_certs':
|
|
799
|
-
check_valid_bool(subvalue, f'{desc} validate certs', err_list)
|
|
800
|
-
else:
|
|
801
|
-
err_list.append(
|
|
802
|
-
f'Unknown setting "{subsetting}" in {desc} section.'
|
|
803
|
-
)
|
|
812
|
+
server_name: str
|
|
813
|
+
server_conf: JsonValue
|
|
814
|
+
for server_name, server_conf in value.items():
|
|
815
|
+
server_config: SmtpServerConfig | None = check_smtp_server(
|
|
816
|
+
server_name, server_conf, err_list
|
|
817
|
+
)
|
|
818
|
+
if server_config:
|
|
819
|
+
smtp_servers[server_name] = server_config
|
|
804
820
|
else:
|
|
805
821
|
err_list.append(f'Unknown setting "{setting}".')
|
|
806
822
|
|
|
807
|
-
|
|
808
|
-
if smtp_servers_conf is None:
|
|
823
|
+
if config.get(section_name) is None:
|
|
809
824
|
err_list.append(f'Configuration section "{section_name}" not found')
|
|
810
825
|
return None
|
|
811
826
|
if len(err_list) > error_count:
|
|
812
827
|
return None
|
|
813
|
-
return
|
|
814
|
-
name: SmtpServerConfig(**conf) # type: ignore # Already checked
|
|
815
|
-
for name, conf in smtp_servers_conf.items()
|
|
816
|
-
}
|
|
828
|
+
return smtp_servers
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
version = 1
|
|
2
|
-
revision =
|
|
2
|
+
revision = 5
|
|
3
3
|
requires-python = ">=3.11"
|
|
4
4
|
resolution-markers = [
|
|
5
5
|
"python_full_version >= '3.14'",
|
|
@@ -1032,8 +1032,9 @@ wheels = [
|
|
|
1032
1032
|
|
|
1033
1033
|
[[package]]
|
|
1034
1034
|
name = "voxutils"
|
|
1035
|
-
version = "0.7.
|
|
1035
|
+
version = "0.7.5"
|
|
1036
1036
|
source = { editable = "." }
|
|
1037
|
+
default-groups = []
|
|
1037
1038
|
dependencies = [
|
|
1038
1039
|
{ name = "aiodns" },
|
|
1039
1040
|
{ name = "aiohttp" },
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|