Jul-05-2022, 05:23 AM
(This post was last modified: Jul-05-2022, 05:23 AM by deanhystad.)
Instead of r.content which returns bytes, use r.text which returns a str.
However I do not understand why you are using json.dump at all. r.text is a json format str. json.dump() converts an object to a json format str. If you just want to write the json str from request to a file, just write r.text to the file. If you aren't converting json to an object or an object to json, there is no reason to use the json library.
However I do not understand why you are using json.dump at all. r.text is a json format str. json.dump() converts an object to a json format str. If you just want to write the json str from request to a file, just write r.text to the file. If you aren't converting json to an object or an object to json, there is no reason to use the json library.