From ca075a9cb7131da6e86319258868b7052e31c166 Mon Sep 17 00:00:00 2001 From: Natan Junges Date: Thu, 23 Feb 2023 14:20:45 -0300 Subject: [PATCH 1/3] item is a dict in polymorphism --- thinq2/model/thinq.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/thinq2/model/thinq.py b/thinq2/model/thinq.py index 591a44e..b4c5743 100644 --- a/thinq2/model/thinq.py +++ b/thinq2/model/thinq.py @@ -69,8 +69,8 @@ class DeviceDescriptor: @post_load(pass_original=True) def polymorphism(self, item, data, **kwargs): - device_schema = device_types.get(item.device_type, Device).Schema() - item.snapshot = device_schema.load(data.get("snapshot", {})) + device_schema = device_types.get(item["device_type"], Device).Schema() + item["snapshot"] = device_schema.load(data.get("snapshot", {})) return item From e5cbbbc127d592e7ebad920934fe1b2066966965 Mon Sep 17 00:00:00 2001 From: Natan Junges Date: Thu, 23 Feb 2023 14:27:54 -0300 Subject: [PATCH 2/3] Fix attrdict and update dependencies --- pyproject.toml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 87b522d..67a4e2d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,22 +6,22 @@ authors = ["tinkerborg "] [tool.poetry.dependencies] python = "^3.7" -uplink = "^0.9.1" -marshmallow = "^3.5.1" -marshmallow-dataclass = "^7.5.0" -inflection = "^0.4.0" +uplink = "^0.9.7" +marshmallow = "^3.19.0" +marshmallow-dataclass = "^8.5.11" +inflection = "^0.5.1" marshmallow_enum = "^1.5.1" -PyOpenSSL = "^19.1.0" -paho-mqtt = "^1.5.0" -attrdict = "^2.0.1" -deepmerge = "^0.1.0" +PyOpenSSL = "^23.0.0" +paho-mqtt = "^1.6.1" +attrdict3 = "^2.0.2" +deepmerge = "^1.1.0" [tool.poetry.dev-dependencies] -pytest = "^5.2" -pylint = "^2.4.4" -black = "^19.10b0" -flake8 = "^3.8.1" -rope = "^0.17.0" +pytest = "^7.2.1" +pylint = "^2.16.2" +black = "^23.1.0" +flake8 = "^6.0.0" +rope = "^1.7.0" [build-system] requires = ["poetry>=0.12"] From 2f50e0ebd01907499d92a839893f496885074777 Mon Sep 17 00:00:00 2001 From: Natan Junges Date: Thu, 23 Feb 2023 14:29:22 -0300 Subject: [PATCH 3/3] Fix SSL context --- thinq2/controller/mqtt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thinq2/controller/mqtt.py b/thinq2/controller/mqtt.py index fa2fde0..c866826 100644 --- a/thinq2/controller/mqtt.py +++ b/thinq2/controller/mqtt.py @@ -79,7 +79,7 @@ def ssl_context(self): private_key_path = temp_dir.file(self.private_key) client_cert_path = temp_dir.file(self.registration.certificate_pem) - context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH) + context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH) context.set_alpn_protocols([AWS_IOTT_ALPN_PROTOCOL]) context.load_verify_locations(cafile=ca_cert_path) context.load_cert_chain(certfile=client_cert_path, keyfile=private_key_path)