Provide better responses for errors (#196); Fix some extract methods

This commit is contained in:
Dylan
2025-04-29 13:30:57 +01:00
parent 1d03bf80e7
commit 54ec334730
5 changed files with 50 additions and 9 deletions

View File

@@ -217,7 +217,7 @@ def getApiResponse(tweet,include_txt=False,include_rtf=False):
totalVotes += option["votes"]
pollData["options"].append(option)
for i in pollData["options"]:
i["percent"] = round((i["votes"]/totalVotes)*100,2)
i["percent"] = round((i["votes"]/totalVotes)*100,2) if totalVotes > 0 else 0
if 'lang' in tweetL:
lang = tweetL['lang']