mirror of
https://github.com/meshtastic/python.git
synced 2026-01-01 20:38:03 -05:00
semi-experimentally, add fallback code for message_to_json, allowing older protobuf library versions
This commit is contained in:
@@ -675,5 +675,8 @@ def check_if_newer_version() -> Optional[str]:
|
||||
|
||||
def message_to_json(message: Message, multiline: bool=False) -> str:
|
||||
"""Return protobuf message as JSON. Always print all fields, even when not present in data."""
|
||||
json = MessageToJson(message, always_print_fields_with_no_presence=True)
|
||||
try:
|
||||
json = MessageToJson(message, always_print_fields_with_no_presence=True)
|
||||
except TypeError:
|
||||
json = MessageToJson(message, including_default_value_fields=True)
|
||||
return stripnl(json) if not multiline else json
|
||||
|
||||
1485
poetry.lock
generated
1485
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@ readme = "README.md"
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.9,<3.14" # 3.9 is needed for pandas, bleak requires <3.14
|
||||
pyserial = "^3.5"
|
||||
protobuf = ">=5.26.0"
|
||||
protobuf = ">=4.21.12"
|
||||
dotmap = "^1.3.30"
|
||||
pexpect = "^4.9.0"
|
||||
pyqrcode = "^1.2.1"
|
||||
@@ -37,7 +37,7 @@ autopep8 = "^2.1.0"
|
||||
pylint = "^3.2.3"
|
||||
pyinstaller = "^6.8.0"
|
||||
mypy = "^1.10.0"
|
||||
mypy-protobuf = "^3.6.0"
|
||||
mypy-protobuf = { version = "^3.3.0", optional = true }
|
||||
types-protobuf = "^5.26.0.20240422"
|
||||
types-tabulate = "^0.9.0.20240106"
|
||||
types-requests = "^2.31.0.20240406"
|
||||
|
||||
Reference in New Issue
Block a user