diff options
| author | Christian Krinitsin <mail@krinitsin.com> | 2025-05-22 20:04:04 +0200 |
|---|---|---|
| committer | Christian Krinitsin <mail@krinitsin.com> | 2025-05-22 20:04:04 +0200 |
| commit | 749d7114661682ad7a9b8c6b7765b499bee6f9fe (patch) | |
| tree | 20880cb1cdff7094027da2d06450a450222c5355 /mailinglist/launchpad.py | |
| parent | 4b41ab2bdca3d6372331e3d04868cce099928e57 (diff) | |
| download | emulator-bug-study-749d7114661682ad7a9b8c6b7765b499bee6f9fe.tar.gz emulator-bug-study-749d7114661682ad7a9b8c6b7765b499bee6f9fe.zip | |
add launchpad-parser
Diffstat (limited to 'mailinglist/launchpad.py')
| -rwxr-xr-x | mailinglist/launchpad.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/mailinglist/launchpad.py b/mailinglist/launchpad.py new file mode 100755 index 00000000..91d6cd8b --- /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) |