From 2840b6333b280ce46b145f1ddb4a97d165e839bc Mon Sep 17 00:00:00 2001 From: "Adrien Bourmault (neox)" Date: Sat, 4 Nov 2023 13:16:04 +0100 Subject: [PATCH] WIP: adhesion, forgejo API --- controle_adhesion/main.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/controle_adhesion/main.py b/controle_adhesion/main.py index 5955fb1..483b2e7 100755 --- a/controle_adhesion/main.py +++ b/controle_adhesion/main.py @@ -17,7 +17,7 @@ # along with this program. If not, see . import os, requests, json, datetime, shutil, quopri, subprocess, base64, os -import time, random, string, dateutil.parser, re, pygitea +import time, random, string, dateutil.parser, re from typing import List from requests.auth import HTTPBasicAuth from requests.auth import HTTPDigestAuth @@ -68,13 +68,10 @@ def gestion_read(req): return response.json() def forgejo_post_issue(owner, repo, title, body, labels): - gt = pygitea.API(GITEA_URL, token=git_get_secret()) - gt_version = gt.get('/version').json() - print("Connected to Forgejo, version: " + str(gt_version['version'])) - import_response: requests.Response = gt.post("/repos/" + owner + "/" + repo + "/issues", json={ - "body": body, - "labels": labels, - "title": title, + import_response: requests.Response = requests.post('https://forge.a-lec.org/api/v1/repos/{}/{}/issues?access_token={}'.format(owner, repo, git_get_secret()), data={ + "body":body, + "labels":labels, + "title":title }) if not(import_response.ok): print("Erreur à l'envoi du ticket {} à {}".format(title, repo))