1
0
Fork 0

"Handle" errors in Steam's API.

This commit is contained in:
Casper V. Kristensen 2019-03-15 01:14:31 +01:00
parent e4452fb167
commit abfbc34259
Signed by: caspervk
GPG key ID: 289CA03790535054
2 changed files with 7 additions and 2 deletions

View file

@ -188,7 +188,11 @@ def parse_dirname(dirname: str, nfo_link: str) -> Optional[Release]:
# If one of the store links we found is to Steam, use their API to get (better) information about the game. # If one of the store links we found is to Steam, use their API to get (better) information about the game.
if "Steam" in store_links: if "Steam" in store_links:
steam.update_info(store_links["Steam"], release) try:
steam.update_info(release)
except Exception as e: # a lot of stuff can go wrong with Steam's API, better catch everything
logger.error("Failed to update release info using Steam's API on %s", release)
logger.exception(e)
logger.info("Final : %s %s : %s - %s : %s", release.platform, release.type, release.game_name, release.group, logger.info("Final : %s %s : %s - %s : %s", release.platform, release.type, release.game_name, release.group,
release) release)

View file

@ -85,8 +85,9 @@ def search(query: str) -> Optional[str]:
return None return None
def update_info(link: str, release: Release) -> None: def update_info(release: Release) -> None:
logger.debug("Getting information about game using Steam API") logger.debug("Getting information about game using Steam API")
link = release.store_links["Steam"]
link_type, appid = re.search("(app|sub|bundle)(?:/)([0-9]+)", link).groups() link_type, appid = re.search("(app|sub|bundle)(?:/)([0-9]+)", link).groups()
if link_type == "bundle": if link_type == "bundle":