How to use the aiogithubapi.AIOGitHubException function in aiogithubapi

To help you get started, we’ve selected a few aiogithubapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github to4ko / myconfig / custom_components / hacs / repositories / repository.py View on Github external
if file.name.lower() in info_files:

                    info = await self.repository_object.get_contents(
                        file.name, self.ref
                    )
                    break
            if info is None:
                self.information.additional_info = ""
            else:
                info = info.content.replace("
github Tommatheussen / Home-Assistant-Configuration / custom_components / hacs / repositories / repository.py View on Github external
if file.name.lower() in info_files:

                    info = await self.repository_object.get_contents(
                        file.name, self.ref
                    )
                    break
            if info is None:
                self.information.additional_info = ""
            else:
                info = info.content.replace("
github aneisch / home-assistant-config / custom_components / hacs / hacsbase / __init__.py View on Github external
async def handle_critical_repositories(self):
        """Handled critical repositories during runtime."""
        # Get critical repositories
        instored = []
        critical = []
        was_installed = False

        try:
            critical = await self.data_repo.get_contents("critical")
            critical = json.loads(critical.content)
        except AIOGitHubException:
            pass

        if not critical:
            self.logger.debug("No critical repositories")
            return

        stored_critical = await async_load_from_store(self.hass, "critical")

        for stored in stored_critical or []:
            instored.append(stored["repository"])

        stored_critical = []

        for repository in critical:
            self.common.blacklist.append(repository["repository"])
            repo = self.get_by_name(repository["repository"])
github DavidFW1960 / home-assistant / custom_components / hacs / setup.py View on Github external
async def load_hacs_repository(hacs):
    """Load HACS repositroy."""
    from .const import VERSION
    from aiogithubapi import (
        AIOGitHubAuthentication,
        AIOGitHubException,
        AIOGitHubRatelimit,
    )

    try:
        repository = hacs().get_by_name("hacs/integration")
        if repository is None:
            await hacs().register_repository("hacs/integration", "integration")
            repository = hacs().get_by_name("hacs/integration")
        if repository is None:
            raise AIOGitHubException("Unknown error")
        repository.status.installed = True
        repository.versions.installed = VERSION
        repository.status.new = False
        hacs.repo = repository.repository_object
        hacs.data_repo = await hacs().github.get_repo("hacs/default")
    except (
        AIOGitHubException,
        AIOGitHubRatelimit,
        AIOGitHubAuthentication,
    ) as exception:
        hacs.logger.critical(f"[{exception}] - Could not load HACS!")
        return False
    return True
github aneisch / home-assistant-config / custom_components / hacs / setup.py View on Github external
async def load_hacs_repository(hacs):
    """Load HACS repositroy."""
    try:
        repository = hacs().get_by_name("hacs/integration")
        if repository is None:
            await hacs().register_repository("hacs/integration", "integration")
            repository = hacs().get_by_name("hacs/integration")
        if repository is None:
            raise AIOGitHubException("Unknown error")
        repository.status.installed = True
        repository.versions.installed = VERSION
        repository.status.new = False
        hacs.repo = repository.repository_object
        hacs.data_repo = await hacs().github.get_repo("hacs/default")
    except (
        AIOGitHubException,
        AIOGitHubRatelimit,
        AIOGitHubAuthentication,
    ) as exception:
        hacs.logger.critical(f"[{exception}] - Could not load HACS!")
        return False
    return True
github to4ko / myconfig / custom_components / hacs / hacsbase / task_factory.py View on Github external
async def safe_register(self, hacs, repo, category):
        async with max_concurrent_tasks:
            try:
                await hacs.register_repository(repo, category)
            except AIOGitHubException as exception:
                logger.error(exception)

            # Due to GitHub ratelimits we need to sleep a bit
            await asyncio.sleep(sleeper)
github klaasnicolaas / Student-homeassistant-config / custom_components / hacs / ws_api_handlers.py View on Github external
repository.status.show_beta = False
            repository.remove()

        elif action == "set_version":
            if msg["version"] == repository.information.default_branch:
                repository.status.selected_tag = None
            else:
                repository.status.selected_tag = msg["version"]
            await repository.update_repository()

        else:
            Hacs().logger.error(f"WS action '{action}' is not valid")

        repository.state = None
        await Hacs().data.async_write()
    except AIOGitHubException as exception:
        hass.bus.async_fire("hacs/error", {"message": str(exception)})
    except AttributeError as exception:
        hass.bus.async_fire(
            "hacs/error", {"message": f"Could not use repository with ID {repo_id}"}
        )
    except Exception as exception:  # pylint: disable=broad-except
        hass.bus.async_fire("hacs/error", {"message": str(exception)})
github DavidFW1960 / home-assistant / custom_components / hacs / ws_api_handlers.py View on Github external
repository.status.show_beta = False
            repository.remove()

        elif action == "set_version":
            if msg["version"] == repository.information.default_branch:
                repository.status.selected_tag = None
            else:
                repository.status.selected_tag = msg["version"]
            await repository.update_repository()

        else:
            Hacs().logger.error(f"WS action '{action}' is not valid")

        repository.state = None
        await Hacs().data.async_write()
    except AIOGitHubException as exception:
        hass.bus.async_fire("hacs/error", {"message": str(exception)})
    except AttributeError as exception:
        hass.bus.async_fire(
            "hacs/error", {"message": f"Could not use repository with ID {repo_id}"}
        )
    except Exception as exception:  # pylint: disable=broad-except
        hass.bus.async_fire("hacs/error", {"message": str(exception)})
github DavidFW1960 / home-assistant / custom_components / hacs / repositories / repository.py View on Github external
info = info.replace("<code>", "<code class="codeinfo">")
                info = info.replace(
                    '<a href="http', '<a rel=">", "<li style="list-style-type: initial;">")

                # Special changes that needs to be done:
                info = info.replace(
                    "</li></a></code></code>