summary refs log tree commit diff stats
path: root/mailinglist/launchpad.py
diff options
context:
space:
mode:
authorChristian Krinitsin <mail@krinitsin.com>2025-05-22 20:04:04 +0200
committerChristian Krinitsin <mail@krinitsin.com>2025-05-22 20:04:04 +0200
commit749d7114661682ad7a9b8c6b7765b499bee6f9fe (patch)
tree20880cb1cdff7094027da2d06450a450222c5355 /mailinglist/launchpad.py
parent4b41ab2bdca3d6372331e3d04868cce099928e57 (diff)
downloadqemu-analysis-749d7114661682ad7a9b8c6b7765b499bee6f9fe.tar.gz
qemu-analysis-749d7114661682ad7a9b8c6b7765b499bee6f9fe.zip
add launchpad-parser
Diffstat (limited to 'mailinglist/launchpad.py')
-rwxr-xr-xmailinglist/launchpad.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/mailinglist/launchpad.py b/mailinglist/launchpad.py
new file mode 100755
index 000000000..91d6cd8b3
--- /dev/null
+++ b/mailinglist/launchpad.py
@@ -0,0 +1,27 @@
+from requests import get
+from os import makedirs, path
+
+def process_launchpad_bug(bug_id):
+    if path.exists(f"output_launchpad/{bug_id}"):
+        return
+
+    bug_url = f"https://api.launchpad.net/1.0/bugs/{bug_id}"
+
+    bug_response = get(url = bug_url)
+
+    bug_data = bug_response.json()
+
+    messages_response = get(url = bug_data['messages_collection_link'])
+
+    messages_data = messages_response.json()
+
+    makedirs("output_launchpad", exist_ok=True)
+    with open(f"output_launchpad/{bug_id}", "w") as file:
+        file.write(f"{bug_data['title']}\n\n")
+
+        for entry in messages_data['entries']:
+            file.write(f"{entry['content']}\n\n")
+
+if __name__ == "__main__":
+    process_launchpad_bug(1629282)
+    process_launchpad_bug(1915063)