pyezvizapi 1.0.3.8__py3-none-any.whl → 1.0.3.9__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.
Potentially problematic release.
This version of pyezvizapi might be problematic. Click here for more details.
- pyezvizapi/client.py +49 -1
- {pyezvizapi-1.0.3.8.dist-info → pyezvizapi-1.0.3.9.dist-info}/METADATA +1 -1
- {pyezvizapi-1.0.3.8.dist-info → pyezvizapi-1.0.3.9.dist-info}/RECORD +7 -7
- {pyezvizapi-1.0.3.8.dist-info → pyezvizapi-1.0.3.9.dist-info}/WHEEL +0 -0
- {pyezvizapi-1.0.3.8.dist-info → pyezvizapi-1.0.3.9.dist-info}/licenses/LICENSE +0 -0
- {pyezvizapi-1.0.3.8.dist-info → pyezvizapi-1.0.3.9.dist-info}/licenses/LICENSE.md +0 -0
- {pyezvizapi-1.0.3.8.dist-info → pyezvizapi-1.0.3.9.dist-info}/top_level.txt +0 -0
pyezvizapi/client.py
CHANGED
|
@@ -357,6 +357,15 @@ class EzvizClient:
|
|
|
357
357
|
individual endpoint behavior. Returns the Response for the caller to
|
|
358
358
|
parse and validate according to its API contract.
|
|
359
359
|
"""
|
|
360
|
+
if _LOGGER.isEnabledFor(logging.DEBUG):
|
|
361
|
+
_LOGGER.debug(
|
|
362
|
+
"HTTP %s %s params=%s data=%s json=%s",
|
|
363
|
+
method,
|
|
364
|
+
url,
|
|
365
|
+
self._summarize_payload(params),
|
|
366
|
+
self._summarize_payload(data),
|
|
367
|
+
self._summarize_payload(json_body),
|
|
368
|
+
)
|
|
360
369
|
try:
|
|
361
370
|
req = self._session.request(
|
|
362
371
|
method=method,
|
|
@@ -388,6 +397,17 @@ class EzvizClient:
|
|
|
388
397
|
)
|
|
389
398
|
raise HTTPError from err
|
|
390
399
|
else:
|
|
400
|
+
if _LOGGER.isEnabledFor(logging.DEBUG):
|
|
401
|
+
content_length = req.headers.get("Content-Length")
|
|
402
|
+
if content_length is None:
|
|
403
|
+
content_length = str(len(req.content))
|
|
404
|
+
_LOGGER.debug(
|
|
405
|
+
"HTTP %s %s -> %s (%s bytes)",
|
|
406
|
+
method,
|
|
407
|
+
url,
|
|
408
|
+
req.status_code,
|
|
409
|
+
content_length,
|
|
410
|
+
)
|
|
391
411
|
return req
|
|
392
412
|
|
|
393
413
|
@staticmethod
|
|
@@ -466,6 +486,24 @@ class EzvizClient:
|
|
|
466
486
|
return payload.get("status")
|
|
467
487
|
return None
|
|
468
488
|
|
|
489
|
+
@staticmethod
|
|
490
|
+
def _summarize_payload(payload: Any) -> str:
|
|
491
|
+
"""Return a compact description of payload content for debug logs."""
|
|
492
|
+
|
|
493
|
+
if payload is None:
|
|
494
|
+
return "-"
|
|
495
|
+
if isinstance(payload, Mapping):
|
|
496
|
+
keys = ", ".join(sorted(str(key) for key in payload))
|
|
497
|
+
return f"dict[{keys}]"
|
|
498
|
+
if isinstance(payload, (list, tuple, set)):
|
|
499
|
+
return f"{type(payload).__name__}(len={len(payload)})"
|
|
500
|
+
if isinstance(payload, (bytes, bytearray)):
|
|
501
|
+
return f"bytes(len={len(payload)})"
|
|
502
|
+
if isinstance(payload, str):
|
|
503
|
+
trimmed = payload[:32] + "…" if len(payload) > 32 else payload
|
|
504
|
+
return f"str(len={len(payload)}, preview={trimmed!r})"
|
|
505
|
+
return f"{type(payload).__name__}"
|
|
506
|
+
|
|
469
507
|
def _ensure_ok(self, payload: dict, message: str) -> None:
|
|
470
508
|
"""Raise PyEzvizError with context if response is not OK.
|
|
471
509
|
|
|
@@ -530,7 +568,17 @@ class EzvizClient:
|
|
|
530
568
|
retry_401=retry_401,
|
|
531
569
|
max_retries=max_retries,
|
|
532
570
|
)
|
|
533
|
-
|
|
571
|
+
payload = self._parse_json(resp)
|
|
572
|
+
if _LOGGER.isEnabledFor(logging.DEBUG):
|
|
573
|
+
_LOGGER.debug(
|
|
574
|
+
"JSON %s %s -> status=%s meta=%s keys=%s",
|
|
575
|
+
method,
|
|
576
|
+
path,
|
|
577
|
+
resp.status_code,
|
|
578
|
+
self._response_code(payload),
|
|
579
|
+
", ".join(sorted(payload.keys())),
|
|
580
|
+
)
|
|
581
|
+
return payload
|
|
534
582
|
|
|
535
583
|
def _retry_json(
|
|
536
584
|
self,
|
|
@@ -3,7 +3,7 @@ pyezvizapi/__main__.py,sha256=6vFvkh8gCD-Mo4CXd1deZfDeaaHR-Kc8pOu9vkUjQf4,20878
|
|
|
3
3
|
pyezvizapi/api_endpoints.py,sha256=2M5Vs4YB1VWZGcowT-4Fj2hhRNjFh976LT3jtRrqvrc,5754
|
|
4
4
|
pyezvizapi/camera.py,sha256=Pl5oIEdrFcv1Hz5sQI1IyyJIDCMjOjQdtExgKzmLoK8,22102
|
|
5
5
|
pyezvizapi/cas.py,sha256=3zHe-_a0KchCmGeAj1of-pV6oMPRUmSCIiDqBFsTK8A,6025
|
|
6
|
-
pyezvizapi/client.py,sha256=
|
|
6
|
+
pyezvizapi/client.py,sha256=VDyqAwa-ogODEGJzjiuZ99lmYh4Q0Hmzr7Hz_roMivc,144065
|
|
7
7
|
pyezvizapi/constants.py,sha256=6-AV7BvQPOQkSXrlrdOhnixDEF3eWiectV5jm5DtRSc,13115
|
|
8
8
|
pyezvizapi/exceptions.py,sha256=8rmxEUQdrziqMe-M1SeeRd0HtP2IDQ2xpJVj7wvOQyo,976
|
|
9
9
|
pyezvizapi/feature.py,sha256=m07s-6aEg0NijwjWZW4EAb23Rrr4RSRaBrYGQlqVwH0,16153
|
|
@@ -13,9 +13,9 @@ pyezvizapi/mqtt.py,sha256=JGjO-uXdKtLidYN1wEZ_bxEKIlNLmnB82Ziiac6oxWs,22373
|
|
|
13
13
|
pyezvizapi/test_cam_rtsp.py,sha256=pbuanoKs_Pryt2f5QctHIngzJG1nD6kv8nulQYh2yPc,5162
|
|
14
14
|
pyezvizapi/test_mqtt.py,sha256=gBaurvo2bu-7sOe14AqNouepJHI-tPWzC3WTpDQbvHM,4155
|
|
15
15
|
pyezvizapi/utils.py,sha256=WHGqI0bIy-G4yX6Vs7i_UDrr7dndx3yzbF_z7rDYGKE,13213
|
|
16
|
-
pyezvizapi-1.0.3.
|
|
17
|
-
pyezvizapi-1.0.3.
|
|
18
|
-
pyezvizapi-1.0.3.
|
|
19
|
-
pyezvizapi-1.0.3.
|
|
20
|
-
pyezvizapi-1.0.3.
|
|
21
|
-
pyezvizapi-1.0.3.
|
|
16
|
+
pyezvizapi-1.0.3.9.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
17
|
+
pyezvizapi-1.0.3.9.dist-info/licenses/LICENSE.md,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
18
|
+
pyezvizapi-1.0.3.9.dist-info/METADATA,sha256=ajd9I1w789VfnPx-TB_w2GaYcz7wzhYxIvIfS6GuupI,7609
|
|
19
|
+
pyezvizapi-1.0.3.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
20
|
+
pyezvizapi-1.0.3.9.dist-info/top_level.txt,sha256=gMZTelIi8z7pXyTCQLLaIkxVRrDQ_lS2NEv0WgfHrHs,11
|
|
21
|
+
pyezvizapi-1.0.3.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|