<s> import requests <EOL> def GetScanList ( config , customer_id = None , active_only = False ) : <EOL> """<STR_LIT>""" <EOL> results = { } <EOL> url = "<STR_LIT>" . format ( config [ '<STR_LIT>' ] ) <EOL> payload = None <EOL> headers = { "<STR_LIT>" : "<STR_LIT:application/json>" } <EOL> if customer_id is not None : <EOL> payload = { } <EOL> payload [ '<STR_LIT>' ] = customer_id <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 , r . url ) ) <EOL> try : <EOL> data = r . json ( ) <EOL> except : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> else : <EOL> for item in data : <EOL> if item [ "<STR_LIT>" ] is False and active_only is True : <EOL> continue <EOL> results [ item [ '<STR_LIT:title>' ] ] = { "<STR_LIT>" : item [ "<STR_LIT>" ] , <EOL> "<STR_LIT:id>" : item [ "<STR_LIT:id>" ] , <EOL> "<STR_LIT:type>" : item [ "<STR_LIT:type>" ] } <EOL> return results </s>
