<s> """<STR_LIT>""" <EOL> from utils import config <EOL> import requests <EOL> import logging <EOL> import pdb <EOL> theConfig = config . Config ( ) <EOL> appConfig = theConfig . getConfigFromFile ( "<STR_LIT>" ) <EOL> logger = theConfig . getLogger ( appConfig ) <EOL> class RestGETDeskCon : <EOL> def __init__ ( self , sourceConfig ) : <EOL> self . apiConfig = sourceConfig ; <EOL> """<STR_LIT>""" <EOL> requiredFields = "<STR_LIT>" <EOL> self . apiConfig = theConfig . validateSourceConfig ( sourceConfig , logger , requiredFields ) <EOL> return None <EOL> def findSourceMatch ( self , lookupVal , lookupKey ) : <EOL> matchingRecord = { } <EOL> try : <EOL> if self . apiConfig [ '<STR_LIT:username>' ] : <EOL> headers = { '<STR_LIT>' : '<STR_LIT:application/json>' , '<STR_LIT>' : '<STR_LIT:application/json>' } <EOL> params = None <EOL> resp = requests . get ( self . apiConfig [ '<STR_LIT>' ] . format ( lookupVal ) , headers = headers , params = params , auth = ( self . apiConfig [ '<STR_LIT:username>' ] , self . apiConfig [ '<STR_LIT:password>' ] ) ) <EOL> except KeyError : <EOL> resp = requests . get ( self . apiConfig [ '<STR_LIT>' ] . format ( lookupVal ) ) <EOL> respJSON = resp . json ( ) <EOL> if self . apiConfig [ '<STR_LIT>' ] : <EOL> for key , val in respJSON [ <NUM_LIT:0> ] . items ( ) : <EOL> matchingRecord [ key ] = val <EOL> else : <EOL> for key , val in respJSON . items ( ) : <EOL> matchingRecord [ key ] = val <EOL> return matchingRecord </s>
