switch-api 0.6.22__tar.gz → 0.6.25__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.
- {switch_api-0.6.22 → switch_api-0.6.25}/PKG-INFO +1 -1
- {switch_api-0.6.22 → switch_api-0.6.25}/setup.py +1 -1
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/__init__.py +1 -1
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_utils/_mqtt.py +8 -1
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/realtime/_mqtt.py +14 -6
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/realtime/realtime.py +1 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api.egg-info/PKG-INFO +1 -1
- {switch_api-0.6.22 → switch_api-0.6.25}/AUTHORS.rst +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/HISTORY.md +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/LICENCE +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/MANIFEST.in +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/README.md +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/pyproject.toml +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/setup.cfg +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_authentication/__init__.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_authentication/_authentication.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_authentication/_credentials_store/__init__.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_authentication/_credentials_store/_credentials_store.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_authentication/_msal/__init__.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_authentication/_msal/_custom_application.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_compute/__init__.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_compute/_commands.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_compute/_compute.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_compute/_iotservice.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_compute/_models.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_compute/_utils.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_guide/__init__.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_guide/main.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_guide/processor.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_utils/__init__.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_utils/_constants.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_utils/_marketplace.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_utils/_platform.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_utils/_utils.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/analytics/__init__.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/analytics/analytics.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/cache/__init__.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/cache/cache.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/controls/__init__.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/controls/_constants.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/controls/_enums.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/controls/_mqtt.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/controls/controls.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/dataset/__init__.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/dataset/dataset.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/email/__init__.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/email/email_sender.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/error_handlers/__init__.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/error_handlers/error_handlers.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/extensions/__init__.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/extensions/extensions.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/extensions/field_meta.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/extensions/helpers.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/extensions/pipeline.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/initialize.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/integration/__init__.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/integration/_utils.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/integration/helpers.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/integration/integration.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/pipeline/__init__.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/pipeline/automation.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/pipeline/definitions.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/pipeline/pipeline.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/platform_insights/__init__.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/platform_insights/platform_insights.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/realtime/__init__.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api/realtime/_redis.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api.egg-info/SOURCES.txt +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api.egg-info/dependency_links.txt +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api.egg-info/requires.txt +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/switch_api.egg-info/top_level.txt +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/tests/test_dataset.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/tests/test_error_handlers.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/tests/test_initialize.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/tests/test_integration.py +0 -0
- {switch_api-0.6.22 → switch_api-0.6.25}/tests/test_pipeline.py +0 -0
|
@@ -16,7 +16,7 @@ setup(
|
|
|
16
16
|
long_description_content_type='text/markdown',
|
|
17
17
|
license='MIT License',
|
|
18
18
|
name="switch_api",
|
|
19
|
-
version="0.6.
|
|
19
|
+
version="0.6.25",
|
|
20
20
|
packages=find_packages(include=["switch_api", "switch_api.*"]),
|
|
21
21
|
install_requires=['pandas==1.5.3', 'requests', 'azure-storage-blob', 'pandera[io]==0.7.1', 'azure-servicebus',
|
|
22
22
|
'msal>=1.11.0', 'paho-mqtt==1.6.1', 'uvicorn==0.22.0', 'fastapi==0.98.0', 'pyodbc==4.0.39', 'cachetools==5.5.0',
|
|
@@ -17,6 +17,7 @@ global _control_ws_port
|
|
|
17
17
|
global _control_ws_username
|
|
18
18
|
global _control_ws_password
|
|
19
19
|
global _control_ws_max_timeout
|
|
20
|
+
global _control_ws_ssl_pwd
|
|
20
21
|
|
|
21
22
|
_control_api_endpoint = ''
|
|
22
23
|
_control_ws_host = ''
|
|
@@ -24,6 +25,7 @@ _control_ws_port = WS_DEFAULT_PORT
|
|
|
24
25
|
_control_ws_username = ''
|
|
25
26
|
_control_ws_password = ''
|
|
26
27
|
_control_ws_max_timeout = WS_MQTT_DEFAULT_MAX_TIMEOUT
|
|
28
|
+
_control_ws_ssl_pwd = ''
|
|
27
29
|
|
|
28
30
|
def get_control_config():
|
|
29
31
|
"""
|
|
@@ -51,6 +53,8 @@ def get_control_config():
|
|
|
51
53
|
Username for MQTT authentication.
|
|
52
54
|
- password : str
|
|
53
55
|
Password for MQTT authentication.
|
|
56
|
+
- ssl_pwd : str
|
|
57
|
+
Password for SSL authentication.
|
|
54
58
|
- max_timeout : int
|
|
55
59
|
Maximum timeout (in seconds) for control operations.
|
|
56
60
|
"""
|
|
@@ -60,11 +64,12 @@ def get_control_config():
|
|
|
60
64
|
"ws_port": _control_ws_port,
|
|
61
65
|
"username": _control_ws_username,
|
|
62
66
|
"password": _control_ws_password,
|
|
67
|
+
"ssl_pwd": _control_ws_ssl_pwd,
|
|
63
68
|
"max_timeout": _control_ws_max_timeout,
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
|
|
67
|
-
def set_mqtt_broker_config(api_endpoint: str, ws_host: str, user_name: str, password: str,
|
|
72
|
+
def set_mqtt_broker_config(api_endpoint: str, ws_host: str, user_name: str, password: str, ws_ssl_pwd: str,
|
|
68
73
|
ws_port: int = WS_DEFAULT_PORT, max_timeout: int = WS_MQTT_DEFAULT_MAX_TIMEOUT, bypass_username_password: bool = False):
|
|
69
74
|
"""Set Control Variables
|
|
70
75
|
|
|
@@ -93,6 +98,7 @@ def set_mqtt_broker_config(api_endpoint: str, ws_host: str, user_name: str, pass
|
|
|
93
98
|
global _control_ws_username
|
|
94
99
|
global _control_ws_password
|
|
95
100
|
global _control_ws_max_timeout
|
|
101
|
+
global _control_ws_ssl_pwd
|
|
96
102
|
|
|
97
103
|
# Check if endpoint is a valid URL
|
|
98
104
|
if not api_endpoint.startswith('https://'):
|
|
@@ -121,4 +127,5 @@ def set_mqtt_broker_config(api_endpoint: str, ws_host: str, user_name: str, pass
|
|
|
121
127
|
_control_ws_port = ws_port
|
|
122
128
|
_control_ws_username = user_name
|
|
123
129
|
_control_ws_password = password
|
|
130
|
+
_control_ws_ssl_pwd = ws_ssl_pwd
|
|
124
131
|
_control_ws_max_timeout = max_timeout
|
|
@@ -44,6 +44,7 @@ class SwitchRealtime:
|
|
|
44
44
|
port: int,
|
|
45
45
|
username: str,
|
|
46
46
|
password: str,
|
|
47
|
+
ssl_pwd: str,
|
|
47
48
|
client_id: str,
|
|
48
49
|
email: str,
|
|
49
50
|
project_id: str
|
|
@@ -56,18 +57,25 @@ class SwitchRealtime:
|
|
|
56
57
|
|
|
57
58
|
self.client_id = client_id
|
|
58
59
|
self.client = mqtt.Client(client_id=client_id, transport='websockets', clean_session=True)
|
|
59
|
-
self.client.tls_set()
|
|
60
|
+
# self.client.tls_set()
|
|
60
61
|
|
|
61
62
|
# -- adhoc for cds engine server --
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
self.client.ws_set_options(path="/mqtt")
|
|
64
64
|
# self.client.tls_set(
|
|
65
65
|
# ca_certs=certifi.where(),
|
|
66
66
|
# cert_reqs=ssl.CERT_REQUIRED,
|
|
67
67
|
# tls_version=ssl.PROTOCOL_TLS_CLIENT,
|
|
68
68
|
# )
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
self.client.tls_set(
|
|
70
|
+
ca_certs='/usr/share/ca-certificates/mozilla/Go_Daddy_Root_Certificate_Authority_-_G2.crt',
|
|
71
|
+
cert_reqs=ssl.CERT_REQUIRED,
|
|
72
|
+
tls_version=ssl.PROTOCOL_TLS_CLIENT,
|
|
73
|
+
certfile='/agent-data/app/CDSTaskOrchestrator.Worker/switch-cert.pem',
|
|
74
|
+
keyfile='/agent-data/app/CDSTaskOrchestrator.Worker/switch-key.pem',
|
|
75
|
+
keyfile_password=ssl_pwd
|
|
76
|
+
)
|
|
77
|
+
self.client.tls_insecure_set(False)
|
|
78
|
+
logger.info("certifi CA bundle: %s", certifi.where())
|
|
71
79
|
# -- adhoc for cds engine server --
|
|
72
80
|
|
|
73
81
|
if username and password:
|
|
@@ -113,7 +121,7 @@ class SwitchRealtime:
|
|
|
113
121
|
logger.info("Reconnecting existing MQTT client network loop.")
|
|
114
122
|
self.client.reconnect()
|
|
115
123
|
else:
|
|
116
|
-
self.client.connect(
|
|
124
|
+
self.client.connect(url.hostname, self.port)
|
|
117
125
|
self.client.loop_start() # Run network loop in background thread
|
|
118
126
|
self._loop_started = True
|
|
119
127
|
|
|
@@ -300,6 +300,7 @@ def submit_realtime_updates(
|
|
|
300
300
|
port=mqtt_config["ws_port"],
|
|
301
301
|
username=mqtt_config["username"],
|
|
302
302
|
password=mqtt_config["password"],
|
|
303
|
+
ssl_pwd=mqtt_config["ssl_pwd"],
|
|
303
304
|
client_id=api_inputs.data_feed_id,
|
|
304
305
|
email=api_inputs.email_address,
|
|
305
306
|
project_id=api_inputs.api_project_id,
|
|
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
|
{switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_authentication/_credentials_store/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{switch_api-0.6.22 → switch_api-0.6.25}/switch_api/_authentication/_msal/_custom_application.py
RENAMED
|
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
|
|
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
|
|
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
|
|
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
|