generated from yanyongyu/python-poetry-template
-
-
Notifications
You must be signed in to change notification settings - Fork 37
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
I have the following module:
import logging
from githubkit import AppAuthStrategy, AppInstallationAuthStrategy, GitHub
from githubkit.exception import RequestFailed
from textmd import config
logger = logging.getLogger("pull_request_opened")
def installation_github(installation_id: int):
return GitHub(
AppInstallationAuthStrategy(
config.GitHubAppID,
config.GithubAppPrivateKey.replace("\\n", "\n"),
installation_id,
)
)
async def pull_request_opened(
installation_id: int,
owner: str,
repo: str,
pull_request_id: int,
settings: dict[str, str],
):
logger.info(
f"Start: installation_id={installation_id}, pull_request_id={pull_request_id}"
)
pr = (
await installation_github(installation_id).rest.pulls.async_get(
owner, repo, pull_request_id
)
).parsed_data
logger.info(f"Pull request title: {pr.title}")While trying to call pull_request_opened() in a Task:
asyncio.create_task(
pull_request_opened(
event.installation.id,
event.repository.owner.login,
event.repository.name,
event.pull_request.id,
{},
)I'm getting error:
RuntimeError: GitHub client has already been collected. Do not use the namespace after the client has been collected.
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested