Option to retrieve raw JSON response
Hi,
Is there a way to retrieve the entire JSON response? In most cases the methods you've created get the job done but at times I would prefer saving the raw JSON response.
Thank you.
One way to do it with the current version would be to use the "private" (as far as privacy goes in Python) method TTRClient._get_json(). The downside to that is that you would need to manually supply it with a json dict with the API commands, which is pretty much what you want to avoid by using this library. :)
I could certainly implement some way to retrieve the raw json response and release a new version though. My thought is to add an optional raw_json=False parameter to the json fetching methods, which just return a json dict/list if it's set to True. Would this solution be suitable to your needs, or do you have another implementation in mind?
Btw, do you need the raw json for something specific, or just for having the possibility of customizing stuff in general? If it's something specific, maybe we could implement it in the library directly, depending on what it is.
Hi Markus,
Thank you for your reply. I'm developing a basic command line article reader.
At the very least I needed the article link and id. I get that from get_headlines. Right now I'm saving them in a csv (this got the job done), but since I have to save the details in some format; I was searching for a way to save the JSON response itself.