#743 - Trying to fix this.

This commit is contained in:
ccostan
2020-05-21 18:48:00 -04:00
parent cf3764e3e4
commit 5c7334bc05
42 changed files with 863 additions and 513 deletions

View File

@@ -1,11 +1,12 @@
"""Helpers to get default repositories."""
import json
from aiogithubapi import AIOGitHub, AIOGitHubException
from aiogithubapi import GitHub, AIOGitHubAPIException
from integrationhelper import Logger
from custom_components.hacs.hacsbase.exceptions import HacsException
from custom_components.hacs.helpers.information import get_repository
async def get_default_repos_orgs(github: type(AIOGitHub), category: str) -> dict:
async def get_default_repos_orgs(github: type(GitHub), category: str) -> dict:
"""Gets default org repositories."""
repositories = []
logger = Logger("hacs")
@@ -22,7 +23,7 @@ async def get_default_repos_orgs(github: type(AIOGitHub), category: str) -> dict
for repo in repos:
repositories.append(repo.full_name)
except AIOGitHubException as exception:
except AIOGitHubAPIException as exception:
logger.error(exception)
return repositories
@@ -38,7 +39,7 @@ async def get_default_repos_lists(session, token, default: str) -> dict:
content = await repo.get_contents(default)
repositories = json.loads(content.content)
except AIOGitHubException as exception:
except (AIOGitHubAPIException, HacsException) as exception:
logger.error(exception)
return repositories