import requests def submit(flags): flag_responses = requests.post('http://example.ctf/flags', json=flags).json() accepted_flags = { item['flag']: item['response'] for item in flag_responses if item['response'].endswith('OK') } rejected_flags = { item['flag']: item['response'] for item in flag_responses if not item['response'].endswith('OK') } return accepted_flags, rejected_flags