Is there a way to dump data from the PyPI Package knowit into a json?

Viewed 13

I'm still a beginner and i maybe know what is the issue here but cant find a solution for it.

I have video files which i want to be inspected by knowit 0.4.0. I import knowit in my python file and use the api function know to inspect the file. It works fine but there some datetime.timedelta which cannot be serialized by json.dumps.

I've looked in the source code of knowit and found that there is an implemented JSONEncoder so i tried to use this. But there is a 'context' variable used which i can't simulate properly to get a json string to dump.

This is the api.py file from knowit using the function in line 42

https://github.com/ratoaq2/knowit/blob/master/knowit/api.py#L42

The funny thing is i get the well formatted output in my logger cause of this line in the main.py from knowit

https://github.com/ratoaq2/knowit/blob/master/knowit/__main__.py#L130

Anyone knows how to dump the result from the knowit.know function to a json with no functions in it so with a pure string?

I think my solution might be here https://github.com/ratoaq2/knowit/blob/master/knowit/serializer.py#L21

But i'm too new into python to understand everything well

Thanks a lot!

0 Answers
Related