A # breaks the feeds.json file #9

Open
opened 2021-05-03 15:41:59 +02:00 by mb · 1 comment

Hmm, maybe a short replacement search/replace can be done? Or are there other ways in Python to check if a JSON object is "safe"?

Hmm, maybe a short replacement search/replace can be done? Or are there other ways in Python to check if a JSON object is "safe"?
Owner

the python3 json library can already do that with the load and loads function.
https://pynative.com/python-json-validation/

I think the trouble is updating the rss feeds to the simple database using db.update on line 41 of feedtools.py

I don't think that function cares about valid json. So load everything into a valid json object using json.load(tmp) and then update that to the SimpleDatabase

in my opinion this is always a better approach than small fixes by hand, now its a #, next time its a "\/". json.loads does that all for you perfectly.

the python3 json library can already do that with the load and loads function. https://pynative.com/python-json-validation/ I think the trouble is updating the rss feeds to the simple database using db.update on line 41 of feedtools.py I don't think that function cares about valid json. So load everything into a valid json object using json.load(tmp) and then update that to the SimpleDatabase in my opinion this is always a better approach than small fixes by hand, now its a #, next time its a "\\/". json.loads does that all for you perfectly.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: varia/multifeeder#9
No description provided.