aioccl 2025.4__py3-none-any.whl → 2025.4.1__py3-none-any.whl
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.
- aioccl/server.py +11 -10
- {aioccl-2025.4.dist-info → aioccl-2025.4.1.dist-info}/METADATA +1 -1
- aioccl-2025.4.1.dist-info/RECORD +9 -0
- {aioccl-2025.4.dist-info → aioccl-2025.4.1.dist-info}/WHEEL +1 -1
- aioccl-2025.4.dist-info/RECORD +0 -9
- {aioccl-2025.4.dist-info → aioccl-2025.4.1.dist-info}/licenses/LICENSE +0 -0
- {aioccl-2025.4.dist-info → aioccl-2025.4.1.dist-info}/top_level.txt +0 -0
aioccl/server.py
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
from __future__ import annotations
|
4
4
|
|
5
|
+
from http import HTTPStatus
|
5
6
|
import logging
|
6
7
|
|
7
8
|
from aiohttp import web
|
@@ -43,22 +44,22 @@ class CCLServer:
|
|
43
44
|
if passkey == ref_passkey:
|
44
45
|
device = ref_device
|
45
46
|
break
|
46
|
-
assert isinstance(device, CCLDevice),
|
47
|
+
assert isinstance(device, CCLDevice), HTTPStatus.NOT_FOUND
|
47
48
|
|
48
|
-
assert request.content_type == "application/json",
|
49
|
-
assert 0 < request.content_length <= 5000,
|
49
|
+
assert request.content_type == "application/json", HTTPStatus.BAD_REQUEST
|
50
|
+
assert 0 < request.content_length <= 5000, HTTPStatus.BAD_REQUEST
|
50
51
|
|
51
52
|
body = await request.json()
|
52
53
|
|
53
54
|
except Exception as err: # pylint: disable=broad-exception-caught
|
54
55
|
status = err.args[0]
|
55
|
-
if status ==
|
56
|
-
text = "400 Bad Request"
|
57
|
-
elif status ==
|
58
|
-
text = "404 Not Found"
|
56
|
+
if status == HTTPStatus.BAD_REQUEST:
|
57
|
+
text = "400 Bad Request."
|
58
|
+
elif status == HTTPStatus.NOT_FOUND:
|
59
|
+
text = "404 Not Found."
|
59
60
|
else:
|
60
|
-
status =
|
61
|
-
text = "500 Internal Server Error"
|
61
|
+
status = HTTPStatus.INTERNAL_SERVER_ERROR
|
62
|
+
text = "500 Internal Server Error."
|
62
63
|
_LOGGER.debug("Request exception occured: %s", err)
|
63
64
|
return web.Response(status=status, text=text)
|
64
65
|
|
@@ -70,7 +71,7 @@ class CCLServer:
|
|
70
71
|
|
71
72
|
device.update_info(info)
|
72
73
|
device.process_data(data)
|
73
|
-
status =
|
74
|
+
status = HTTPStatus.OK
|
74
75
|
text = "200 OK"
|
75
76
|
_LOGGER.debug("Request processed: %s", passkey)
|
76
77
|
return web.Response(status=status, text=text)
|
@@ -0,0 +1,9 @@
|
|
1
|
+
aioccl/__init__.py,sha256=XnegKtbvHvUTwVuuWNLb4LB9ZuGGar0xrZYOqk7scyg,133
|
2
|
+
aioccl/device.py,sha256=7UUEcg__1Q-gug8E5nuTAP_TWVeyoeuZSvNNUjIwJ1g,5691
|
3
|
+
aioccl/sensor.py,sha256=-yWdgBzOzLPHP2GBqvhVVGbIlt17y_3OSHibhB_DsQ8,16905
|
4
|
+
aioccl/server.py,sha256=niD0h2i6rS1qr4vCmepwEBhVIylvVGt7_WbBO0-Z1Rs,3377
|
5
|
+
aioccl-2025.4.1.dist-info/licenses/LICENSE,sha256=PBRsTHchx7o0TQ2R2ktEAfFmn1iNHTxcOP_xaeuSAuo,11349
|
6
|
+
aioccl-2025.4.1.dist-info/METADATA,sha256=ji9-K-ycxbCAYi6wlmFwdkk30DUMKKQ7mc280er0vtA,991
|
7
|
+
aioccl-2025.4.1.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
8
|
+
aioccl-2025.4.1.dist-info/top_level.txt,sha256=-xIJfyfXTaW_EH7XCIHyxjSSSwjLmawa2qhsrHZH1vA,7
|
9
|
+
aioccl-2025.4.1.dist-info/RECORD,,
|
aioccl-2025.4.dist-info/RECORD
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
aioccl/__init__.py,sha256=XnegKtbvHvUTwVuuWNLb4LB9ZuGGar0xrZYOqk7scyg,133
|
2
|
-
aioccl/device.py,sha256=7UUEcg__1Q-gug8E5nuTAP_TWVeyoeuZSvNNUjIwJ1g,5691
|
3
|
-
aioccl/sensor.py,sha256=-yWdgBzOzLPHP2GBqvhVVGbIlt17y_3OSHibhB_DsQ8,16905
|
4
|
-
aioccl/server.py,sha256=RvWH6hqlQDq82u_8oO69SA0qeCDWGdVoi0wb5uYKQrs,3216
|
5
|
-
aioccl-2025.4.dist-info/licenses/LICENSE,sha256=PBRsTHchx7o0TQ2R2ktEAfFmn1iNHTxcOP_xaeuSAuo,11349
|
6
|
-
aioccl-2025.4.dist-info/METADATA,sha256=e5mkGmPL4RnVj1XCNqXRW8NOybwroWVyhlezyIe6yCY,989
|
7
|
-
aioccl-2025.4.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
|
8
|
-
aioccl-2025.4.dist-info/top_level.txt,sha256=-xIJfyfXTaW_EH7XCIHyxjSSSwjLmawa2qhsrHZH1vA,7
|
9
|
-
aioccl-2025.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|