Skip to content
Snippets Groups Projects
Commit 77fdac23 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

doc.py: fix gitlab api use

parent 95e0d99d
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
from io import BytesIO
from os import environ
from pathlib import Path
from zipfile import ZipFile
......@@ -11,6 +12,7 @@ GITLAB = "https://gitlab.laas.fr"
RAINBOARD = "https://rainboard.laas.fr"
INDEX = DOC / "index.html"
HEAD = DOC / "index.head.html"
TOKEN = environ["GITLAB_TOKEN"]
if __name__ == "__main__":
with INDEX.open("w") as f, HEAD.open() as head:
......@@ -19,9 +21,11 @@ if __name__ == "__main__":
for project, namespace, branch in sorted(
httpx.get(f"{RAINBOARD}/doc").json()["ret"]
):
url = f"{GITLAB}/{namespace}/{project}/-/jobs/artifacts/{branch}/download"
url = f"{GITLAB}/api/v4/projects/{namespace}%2F{project}/jobs/artifacts/{branch}/download"
path = DOC / namespace / project / branch
r = httpx.get(url, params={"job": "doc-coverage"})
r = httpx.get(
url, params={"job": "doc-coverage"}, headers={"Private-Token": TOKEN}
)
try:
z = ZipFile(BytesIO(r.content))
path.mkdir(parents=True, exist_ok=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment