@@ -24,23 +24,30 @@ def wrapper(self, *args, **kwargs):
2424
2525
2626class QBResponse (dict ):
27+ def __init__ (self , requests_response ):
28+ super ().__init__ ()
29+ self .ok = requests_response .ok
30+ self .status_code = requests_response .status_code
31+ self .text = requests_response .text
32+
2733
28- def __init__ (self , response_type , ** kwargs ):
29- self .response_type = response_type
34+ class QBQueryResponse (QBResponse ):
35+
36+ def __init__ (self , res , ** kwargs ):
37+ self .response_type = 'records'
3038 self .operations = []
3139 # potential to load sample data for testing
3240 if kwargs .get ('sample_data' ):
3341 self .update (kwargs .get ('sample_data' ))
34- super ().__init__ ()
42+ super ().__init__ (requests_response = res )
3543
3644 def info (self , prt = True ):
3745 """
3846 Prints information about the response.
3947 :prt: Set to False to only grab the return as a string.
4048 """
4149 if self .response_type == 'records' :
42- info = []
43- info .append (f'{ Bcolors .OKBLUE } Sample Data:\n ' )
50+ info = [f'{ Bcolors .OKBLUE } Sample Data:\n ' ]
4451 try :
4552 info .append ('\t ' + str (self .get ('data' )[0 ]) + '\n \n ' )
4653 except KeyError as e :
@@ -266,7 +273,7 @@ def c_currency(currency_format):
266273 else :
267274 for d in self .get ('data' ):
268275 fmt = currency_format + "{:,.2f}" .format (d .get (fid ).get ('value' ))
269- d .update ({fid : {'value' : fmt }})
276+ d .update ({fid : {'value' : fmt }})
270277
271278 if field_type == 'datetime' :
272279 c_datetime ()
0 commit comments