Skip to content

Commit

Permalink
Crear objeto GithubIntegration en cada request.
Browse files Browse the repository at this point in the history
  • Loading branch information
dato committed Aug 24, 2024
1 parent 8ebe12b commit 0e3dcda
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 0e3dcda

Please sign in to comment.