#NEWLINE# def execute( self , query , params = None , **kwargs ) : #NEWLINE# #INDENT# 'Execute YQL query' #NEWLINE# yqlquery = YQLQuery ( params ) #NEWLINE# url = self . get_uri ( yqlquery , params , ** kwargs ) #NEWLINE# yql_logger . debug ( 'executed url: %s' , url ) #NEWLINE# http_method = yqlquery . get_http_method ( ) #NEWLINE# if ( http_method in [ 'DELETE' , 'PUT' , 'POST' ] ) : #NEWLINE# #INDENT# data = { #NEWLINE# #INDENT# 'q' : query , #NEWLINE# #UNINDENT# } #NEWLINE# data = json . dumps ( data ) #NEWLINE# headers = { #NEWLINE# #INDENT# 'Content-Type' : 'application/json' , #NEWLINE# #UNINDENT# } #NEWLINE# ( resp , content ) = self . http . request ( url , http_method , headers = headers , body = data ) #NEWLINE# yql_logger . debug ( 'body: %s' , data ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( resp , content ) = self . http . request ( url , http_method ) #NEWLINE# #UNINDENT# yql_logger . debug ( 'http_method: %s' , http_method ) #NEWLINE# if ( resp . get ( 'status' ) == '200' ) : #NEWLINE# #INDENT# return YQLObj ( json . loads ( content ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise YQLError ( resp , content )