@@ -136,8 +136,7 @@ def get_portfolio(self):
136
136
timeout = self .timeout ,
137
137
)
138
138
if portfolio .status_code != 200 :
139
- print ("Portfolio request failed" )
140
- print (portfolio .text )
139
+ print (f"Portfolio request failed: { portfolio .text } " )
141
140
return None
142
141
return portfolio .json ()
143
142
@@ -236,8 +235,7 @@ def place_order(
236
235
timeout = self .timeout ,
237
236
)
238
237
if preflight .status_code != 200 :
239
- print (preflight .text )
240
- raise Exception ("Preflight failed" )
238
+ raise Exception (f"Preflight failed: { preflight .text } " )
241
239
preflight = preflight .json ()
242
240
# Build order endpoint
243
241
build_response = self .session .post (
@@ -247,7 +245,6 @@ def place_order(
247
245
timeout = self .timeout ,
248
246
)
249
247
if build_response .status_code != 200 :
250
- print (build_response .text )
251
248
raise Exception (f"Build order failed: { build_response .text } " )
252
249
build_response = build_response .json ()
253
250
if build_response .get ("orderId" ) is None :
@@ -261,12 +258,10 @@ def place_order(
261
258
timeout = self .timeout ,
262
259
)
263
260
if submit_response .status_code != 200 :
264
- print (submit_response .text )
265
- raise Exception ("Submit order failed" )
261
+ raise Exception (f"Submit order failed: { submit_response .text } " )
266
262
submit_response = submit_response .json ()
267
263
# Empty dict is success
268
264
if submit_response != {}:
269
- print (f"Submit response: { submit_response } " )
270
265
raise Exception (f"Order failed: { submit_response } " )
271
266
sleep (1 )
272
267
# Check if order was rejected
0 commit comments