Skip to content

Commit

Permalink
catch URLError while scraping tft version from play store
Browse files Browse the repository at this point in the history
  • Loading branch information
akshualy committed May 21, 2024
1 parent 089b962 commit cfb824d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import os
from random import Random
import sys
from urllib.error import HTTPError
from urllib.error import HTTPError, URLError
import urllib.request

from adb_shell.exceptions import TcpTimeoutException
Expand Down Expand Up @@ -347,7 +347,14 @@ async def check_phone_preconditions(adb_instance: ADB):

logger.debug("Checking TFT app version")
installed_version = await adb_instance.get_tft_version()
play_store_version = google_play_scraper.app(adb_instance.tft_package_name)["version"]
try:
play_store_version = google_play_scraper.app(adb_instance.tft_package_name)["version"]
except URLError as exc:
logger.opt(exception=exc).debug("URLError while getting Google Play TFT app version.")
logger.warning(
"Could not get the newest TFT app version from Google. Assuming the app is on the newest version."
)
play_store_version = installed_version

if helpers.is_version_string_newer(play_store_version, installed_version):
raise_and_exit("A new version of the TFT app is available. Please update to not be locked in queue.")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "alune"
version = "0.1.1"
version = "0.1.2"
authors = [
{name = "akshualy"},
{name = "Detergent13"},
Expand Down

0 comments on commit cfb824d

Please sign in to comment.