From 0e3dcdad4eceb2ebbb9697ddc9b2d069dd316985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adeodato=20Sim=C3=B3?= Date: Sat, 24 Aug 2024 00:40:23 -0300 Subject: [PATCH] Crear objeto GithubIntegration en cada request. Para evitar: https://github.com/PyGithub/PyGithub/issues/2431 --- main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 65ad530..3428df3 100644 --- a/main.py +++ b/main.py @@ -32,9 +32,6 @@ app.config["MAX_CONTENT_LENGTH"] = 4 * 1024 * 1024 # 4 MiB cfg: Settings = load_config() -gh: github.GithubIntegration = github.GithubIntegration( - cfg.github_app_id, open(cfg.github_app_keyfile).read() -) cache: Cache = Cache(config={"CACHE_TYPE": "simple"}) cache.init_app(app) @@ -232,6 +229,11 @@ def post(): relpath_base = pathlib.PurePath("parcialitos") / cfg.cuatri / tp_id if alu_repo is not None: + # Crear este objeto cada vez para evitar + # https://github.com/PyGithub/PyGithub/issues/2431. + gh = github.GithubIntegration( + cfg.github_app_id, open(cfg.github_app_keyfile).read() + ) auth_token = cfg.github_token.get_secret_value() try: installation = gh.get_installation(alu_repo.owner, alu_repo.name)