wechatbot-sdk 0.2.0__tar.gz → 0.2.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wechatbot-sdk
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: WeChat iLink Bot SDK for Python — async, typed, production-grade
5
5
  License: MIT
6
6
  Requires-Python: >=3.9
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "wechatbot-sdk"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  description = "WeChat iLink Bot SDK for Python — async, typed, production-grade"
5
5
  readme = "README.md"
6
6
  license = { text = "MIT" }
@@ -85,9 +85,10 @@ async def _parse_response(resp: aiohttp.ClientResponse, label: str) -> dict[str,
85
85
  )
86
86
 
87
87
  ret = payload.get("ret")
88
- if isinstance(ret, int) and ret != 0:
89
- code = payload.get("errcode", ret)
90
- msg = payload.get("errmsg") or f"{label} failed (ret={ret})"
88
+ errcode = payload.get("errcode")
89
+ if (isinstance(ret, int) and ret != 0) or (isinstance(errcode, int) and errcode != 0):
90
+ code = errcode if isinstance(errcode, int) and errcode != 0 else (ret or 0)
91
+ msg = payload.get("errmsg") or f"{label} failed (ret={ret} errcode={errcode})"
91
92
  raise ApiError(msg, http_status=resp.status, errcode=code, payload=payload)
92
93
 
93
94
  return payload
File without changes
File without changes