I'll preface this by saying that I'm learning to develop/code through online tutorials. I am certain I'm not always using the right words, so please bear with me.
I have a script that uses wikidata API to enrich a staging table in a PostgressDB on Supabase. When I run the script locally, it works just fine. When I run it using github actions - it kicks back either a HTTP 400 or HTTP 429, which surprises me because I have secrets setup on GitHub for my Wiki token.
All this is to say, since I don't understand exactly what's failing, i don't know what to specifically ask but I would be most appreciative if someone could point me in the right direction or tell me if this is a simple fix or what. Attached is my script.
Here's a sample from the log file that's created when I run the script. It's roughly 21000 lines of failures and all of them are either 400 or 429.
the script: #1378867091754451125 message
2025-06-01 14:24:33,236 | ERROR | Wikidata request failed for Q4909858: HTTP 400 | URL: https://www.wikidata.org/wiki/Special:EntityData/Q4909858.json
2025-06-01 14:24:33,882 | ERROR | Wikidata request failed for Q4908749: HTTP 400 | URL: https://www.wikidata.org/wiki/Special:EntityData/Q4908749.json
2025-06-01 14:24:34,403 | ERROR | Wikidata request failed for Q2939390: HTTP 429 | URL: https://www.wikidata.org/wiki/Special:EntityData/Q2939390.json
2025-06-01 14:24:34,924 | ERROR | Wikidata request failed for Q4913241: HTTP 429 | URL: https://www.wikidata.org/wiki/Special:EntityData/Q4913241.json```