<s> import requests <EOL> def booleen2string ( booleen ) : <EOL> if booleen is True : <EOL> return "<STR_LIT:true>" <EOL> else : <EOL> return "<STR_LIT:false>" <EOL> def GetScanResults ( config , scan_exec_id , new_vulns = False , new_ports = False ) : <EOL> """<STR_LIT>""" <EOL> url = "<STR_LIT>" . format ( config [ '<STR_LIT>' ] , scan_exec_id ) <EOL> payload = { } <EOL> payload = { '<STR_LIT>' : booleen2string ( new_vulns ) , <EOL> '<STR_LIT>' : booleen2string ( new_ports ) } <EOL> headers = { "<STR_LIT>" : "<STR_LIT:application/json>" } <EOL> try : <EOL> r = requests . get ( url , <EOL> headers = headers , <EOL> auth = ( config [ '<STR_LIT>' ] , '<STR_LIT>' ) , <EOL> params = payload ) <EOL> r . raise_for_status ( ) <EOL> except : <EOL> raise ValueError ( "<STR_LIT>" % r . status_code ) <EOL> try : <EOL> data = r . json ( ) <EOL> except : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> else : <EOL> return data </s>
