Skip to content

Commit

Permalink
fix guthub api issues gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
Rhys committed May 7, 2021
1 parent 6a2e08e commit 58249dd
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions load.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


this = sys.modules[__name__] # For holding module globals
this.VersionNo = "2.2.1"
this.VersionNo = "2.2.2"
this.FactionNames = []
this.TodayData = {}
this.YesterdayData = {}
Expand Down Expand Up @@ -126,11 +126,15 @@ def plugin_start(plugin_dir):

# this.LastTick.set("12")

response = requests.get(
"https://api.github.com/repos/rhyspowell/BGS-Tally/releases/latest"
) # check latest version
latest = response.json()
this.GitVersion = latest["tag_name"]
try:
response = requests.get(
"https://api.github.com/repos/rhyspowell/BGS-Tally/releases/latest"
) # check latest version
latest = response.json()
this.GitVersion = latest["tag_name"]
except KeyError:
logger.error("Failed to get latest version from the github api")
this.GitVersion = "Connection Error"
# tick check and counter reset
response = requests.get(
"https://elitebgs.app/api/ebgs/v5/ticks"
Expand Down

0 comments on commit 58249dd

Please sign in to comment.