real simple but I'm having difficulties navigating the docs.
Reference: https://docs.telethon.dev/en/stable/modules/events.html?highlight=raw_update#telethon.events.raw.Raw
I'm trying to do something really simple, I'm using the Event @client.on(events.Raw) to collect updates, but I'm having difficulties trying to convert the raw update to a serializable JSON result in it's full unaltered state, any suggestions?
I understand to_dict() works, but in some updates, it returns objects within the dictionary, for example the date field would look something like this 'date': datetime.datetime(2023, 5, 18, 22, 36, 38, tzinfo=datetime.timezone.utc)
why do you need it unaltered? you got the to_json() instead which patches the unserializable stuff and sanitizes them
Unaltered because just as i explained, when trying to serialize an object i also get unexpected object values that cannot be serialized to json
no one mentioned Event class, you said Raw() handler updates, they're all TLobjects and have a to_json
this doesn't explain your purpose with data you serialize, are you willing to deserialize them again or the point of it, you can just patch out "alter" the fields to make it json serializable
Huh, but that still doesn’t work
Обсуждают сегодня