Tradingeconomics wants you to pay a ridiculous amount for the privilege of exporting public data as csv.
Their site obtains economic data from some api in base64, gzip and XOR encrypted form. I (kinda, got help from Chatgpt) made a script to decrypt and convert data to a readable excel sheet.
https://pastebin.com/raw/gxXZnN37
Few notes:
isoformat
method you can use instead of manually specifying the iso format for dates.if good; return happy; else; return sad
withif bad; return sad; return happy
. Its easier to read and saves you some indents. It might offend functional programmers but this is python.Critiquing because its otherwise really good. Slap some argparsing on top. If you want to do bulk downloads look into asyncio and httpx.
I will forever hate whatever bazinga wrote this into whatever style guide that has this opinion. The first is way easier imo, it's explicit that if this happens, then return this, if anything else, return that. The latter you have to fill in a tiny gap when reading to put in the inferred else clause that's not written down to figure it out
Regardless, if I wanted to be an asshole for work politics in this situation I'd comment "aKScHuaLLy
return happy if good else sad
is better"