From 749d7114661682ad7a9b8c6b7765b499bee6f9fe Mon Sep 17 00:00:00 2001 From: Christian Krinitsin Date: Thu, 22 May 2025 20:04:04 +0200 Subject: add launchpad-parser --- mailinglist/launchpad.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 mailinglist/launchpad.py (limited to 'mailinglist/launchpad.py') 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) -- cgit 1.4.1