N
N
Northages2018-12-29 17:23:56
Python
Northages, 2018-12-29 17:23:56

Telegram bot in python. How to write an incoming json subobject to a dictionary?

I am writing a cart bot using the telebot library. Depended on the implementation of one function for it. Bottom line: I send him audio recordings, he must copy all the data from the 'audio' json object into a python dictionary to write to a file. Tried like this,
data.append(message.audio)
but it throws an error:

TypeError: Object of type Audio is not JSON serializable

I'm learning Python along the way, until I know a lot (don't throw your slippers too hard). Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yura Khlyan, 2018-12-29
@Northages

You need to look at the type Audio, and what method to get dict-like information from it.
To the extreme, you can use__dict__

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question