How to use the gidgethub.aiohttp.GitHubAPI function in gidgethub

To help you get started, we’ve selected a few gidgethub 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 python / the-knights-who-say-ni / ni / github.py View on Github external
def __init__(self, server: ni_abc.ServerHost, client: aiohttp.ClientSession,
                 event: PullRequestEvent,
                 request: JSONDict) -> None:
        """Represent a contribution."""
        self.server = server
        self.event = event
        self.request = request
        self._gh = GitHubAPI(client, "the-knights-who-say-ni",
                             oauth_token=server.contrib_auth_token())
github Mariatta / gh_app_demo / __main__.py View on Github external
async def main():
    async with aiohttp.ClientSession() as session:
        app_id = os.getenv("GH_APP_ID")

        jwt = get_jwt(app_id)
        gh = GitHubAPI(session, "Mariatta")

        try:
            installation = await get_installation(gh, jwt, "Mariatta")

        except ValueError as ve:
            # Raised if Mariatta did not installed the GitHub App
            print(ve)
        else:
            access_token = await get_installation_access_token(
                gh, jwt=jwt, installation_id=installation["id"]
            )

            # treat access_token as if a personal access token

            # Example, creating a GitHub issue as a GitHub App
            gh_app = GitHubAPI(session, "black_out", oauth_token=access_token["token"])
github bioconda / bioconda-utils / bioconda_utils / githubhandler.py View on Github external
def create_api_object(self, session: aiohttp.ClientSession,
                          requester: str, *args, **kwargs) -> None:
        self.api = gidgethub.aiohttp.GitHubAPI(
            session, requester, oauth_token=self.token,
            cache=cachetools.LRUCache(maxsize=500)
        )
        self.session = session
github pyslackers / sir-bot-a-lot-2 / sirbot / plugins / github / plugin.py View on Github external
def load(self, sirbot):
        LOG.info("Loading github plugin")
        self.api = GitHubAPI(session=sirbot.http_session, requester=sirbot.user_agent)

        sirbot.router.add_route("POST", "/github", dispatch)