WIP: adhesion, forgejo API
This commit is contained in:
parent
875d8c95f6
commit
2840b6333b
|
@ -17,7 +17,7 @@
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import os, requests, json, datetime, shutil, quopri, subprocess, base64, os
|
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 typing import List
|
||||||
from requests.auth import HTTPBasicAuth
|
from requests.auth import HTTPBasicAuth
|
||||||
from requests.auth import HTTPDigestAuth
|
from requests.auth import HTTPDigestAuth
|
||||||
|
@ -68,13 +68,10 @@ def gestion_read(req):
|
||||||
return response.json()
|
return response.json()
|
||||||
|
|
||||||
def forgejo_post_issue(owner, repo, title, body, labels):
|
def forgejo_post_issue(owner, repo, title, body, labels):
|
||||||
gt = pygitea.API(GITEA_URL, token=git_get_secret())
|
import_response: requests.Response = requests.post('https://forge.a-lec.org/api/v1/repos/{}/{}/issues?access_token={}'.format(owner, repo, git_get_secret()), data={
|
||||||
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,
|
"body":body,
|
||||||
"labels":labels,
|
"labels":labels,
|
||||||
"title": title,
|
"title":title
|
||||||
})
|
})
|
||||||
if not(import_response.ok):
|
if not(import_response.ok):
|
||||||
print("Erreur à l'envoi du ticket {} à {}".format(title, repo))
|
print("Erreur à l'envoi du ticket {} à {}".format(title, repo))
|
||||||
|
|
Loading…
Reference in New Issue