From fac715cd71675861766732fb84741e4e25c6995b Mon Sep 17 00:00:00 2001 From: Christian Krinitsin Date: Fri, 23 May 2025 13:14:55 +0200 Subject: check json for launchpad bugs --- mailinglist/launchpad.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'mailinglist/launchpad.py') diff --git a/mailinglist/launchpad.py b/mailinglist/launchpad.py index 91d6cd8b..a5a57d7c 100755 --- a/mailinglist/launchpad.py +++ b/mailinglist/launchpad.py @@ -1,14 +1,17 @@ from requests import get from os import makedirs, path -def process_launchpad_bug(bug_id): +def process_launchpad_bug(bug_id) -> bool: if path.exists(f"output_launchpad/{bug_id}"): - return + return false bug_url = f"https://api.launchpad.net/1.0/bugs/{bug_id}" bug_response = get(url = bug_url) + if not 'application/json' in bug_response.headers.get('Content-Type', ''): + return false + bug_data = bug_response.json() messages_response = get(url = bug_data['messages_collection_link']) @@ -21,7 +24,4 @@ def process_launchpad_bug(bug_id): for entry in messages_data['entries']: file.write(f"{entry['content']}\n\n") - -if __name__ == "__main__": - process_launchpad_bug(1629282) - process_launchpad_bug(1915063) + return true -- cgit v1.2.3