Skip to content

Commit

Permalink
Add ignore_broken_payload to hide the exception for broken payload …
Browse files Browse the repository at this point in the history
…parsing
  • Loading branch information
isaackogan committed Sep 13, 2024
1 parent d96dfcb commit 4f51394
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion TikTokLive/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def __init__(
level=LogLevel.ERROR
)

# Overridable properties
self.ignore_broken_payload: bool = False

# Properties
self._unique_id: str = self.parse_unique_id(unique_id)
self._room_id: Optional[int] = None
Expand Down Expand Up @@ -359,7 +362,8 @@ def _parse_webcast_response(self, response: Optional[WebcastResponseMessage]) ->
try:
proto_event: ProtoEvent = event_type().parse(response.payload)
except Exception:
self._logger.error(traceback.format_exc() + "\nBroken Payload:\n" + str(response.payload))
if not self.ignore_broken_payload:
self._logger.error(traceback.format_exc() + "\nBroken Payload:\n" + str(response.payload))
return [response_event]

parsed_events: List[Event] = [response_event, proto_event]
Expand Down

0 comments on commit 4f51394

Please sign in to comment.