From af94e1e186a5ff75be7ea7cc6ed1108e74e7dc57 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Tue, 25 Jun 2019 10:37:40 +0800 Subject: [PATCH] [Del] remove unnecessary try...catch --- vnpy/api/rest/rest_client.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/vnpy/api/rest/rest_client.py b/vnpy/api/rest/rest_client.py index ce2fb60a..59ff4a42 100644 --- a/vnpy/api/rest/rest_client.py +++ b/vnpy/api/rest/rest_client.py @@ -257,13 +257,10 @@ class RestClient(object): ) request.response = response status_code = response.status_code - if status_code // 100 == 2: # 2xx都算成功,尽管交易所都用200 - try: - jsonBody = response.json() - request.callback(jsonBody, request) - request.status = RequestStatus.success - except: - print("not json body from request, check body: ",response.text) + if status_code // 100 == 2: # 2xx codes are all successful + json_body = response.json() + request.callback(json_body, request) + request.status = RequestStatus.success else: request.status = RequestStatus.failed