bug(#1974): verify GitHub API response before trying to access the JSON dictionary

pull/1975/head
Rafael de Bem 2 years ago
parent 05792ca41d
commit 32ea6560c4
No known key found for this signature in database

@ -7,6 +7,11 @@ def checkversion(__VERSION__: str):
response = requests.get(
"https://api.github.com/repos/elebumm/RedditVideoMakerBot/releases/latest"
)
if response.status_code == 403: # Rate limit
print(
f"Skipping script version check because we exceeded GitHub's rate limit. Using version ({__VERSION__})."
)
return
latestversion = response.json()["tag_name"]
if __VERSION__ == latestversion:
print_step(f"You are using the newest version ({__VERSION__}) of the bot")

Loading…
Cancel
Save