summary refs log tree commit diff stats
path: root/gitlab/downloader.py
diff options
context:
space:
mode:
authorChristian Krinitsin <mail@krinitsin.com>2025-05-18 16:17:59 +0200
committerChristian Krinitsin <mail@krinitsin.com>2025-05-18 16:17:59 +0200
commita9eb56beab0a66199b6fc7844132d28ba81174fa (patch)
treec918fe98b6fe49c20956646efa052fe7fb7b5889 /gitlab/downloader.py
parent53d4922d51b6b40ed85367ec611773abe47421e5 (diff)
downloadqemu-analysis-a9eb56beab0a66199b6fc7844132d28ba81174fa.tar.gz
qemu-analysis-a9eb56beab0a66199b6fc7844132d28ba81174fa.zip
move project to gitlab directory
Diffstat (limited to 'gitlab/downloader.py')
-rwxr-xr-xgitlab/downloader.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/gitlab/downloader.py b/gitlab/downloader.py
new file mode 100755
index 000000000..2b73f1cf5
--- /dev/null
+++ b/gitlab/downloader.py
@@ -0,0 +1,38 @@
+from requests import get
+from description_parser import parse_description
+from output import output_issue
+
+project_id = 11167699
+per_page = 100
+url = f"https://gitlab.com/api/v4/projects/{project_id}/issues?per_page={per_page}"
+
+def pages_iterator(first):
+    current = first
+    while current.links.get('next'):
+        current.raise_for_status()
+        yield current
+        current = get(url = current.links.get('next').get('url'))
+    current.raise_for_status()
+    yield current
+
+def main():
+    for response in pages_iterator(get(url = url)):
+        print(f"Current page: {response.headers['x-page']}")
+
+        data = response.json()
+        for i in data:
+            issue = {
+                "id": i['iid'],
+                "title": i['title'],
+                "state": i['state'],
+                "created_at": i['created_at'],
+                "closed_at": i['closed_at'] if i['closed_at'] else "n/a",
+                "labels": i['labels'],
+                "url": i['web_url']
+            }
+
+            issue = issue | parse_description(i['description'])
+            output_issue(issue)
+
+if __name__ == "__main__":
+    main()