remove not used rest_client
1. "json的内容可以通过设置Content-Type为application/json达成,没必要单独增加一个json字段。" remove not used code 2. 在alpaca撤单调试过程中,发生返回值200,但body.text是json的情况,致rest_client解析json报错,加了try/catch做处理
This commit is contained in:
parent
08d3b26a5d
commit
17fe9bf914
@ -49,10 +49,6 @@ class Request(object):
|
||||
|
||||
self.response = None
|
||||
self.status = RequestStatus.ready
|
||||
self.json=None
|
||||
|
||||
def set_json(self, json_str: dict):
|
||||
self.json=json_str
|
||||
|
||||
def __str__(self):
|
||||
if self.response is None:
|
||||
@ -65,7 +61,6 @@ class Request(object):
|
||||
"headers: {}\n"
|
||||
"params: {}\n"
|
||||
"data: {}\n"
|
||||
"json: {}\n"
|
||||
"response:"
|
||||
"{}\n".format(
|
||||
self.method,
|
||||
@ -75,7 +70,6 @@ class Request(object):
|
||||
self.headers,
|
||||
self.params,
|
||||
self.data,
|
||||
self.json,
|
||||
"" if self.response is None else self.response.text,
|
||||
)
|
||||
)
|
||||
@ -151,7 +145,6 @@ class RestClient(object):
|
||||
on_failed: Callable = None,
|
||||
on_error: Callable = None,
|
||||
extra: Any = None,
|
||||
json_str: dict = None,
|
||||
):
|
||||
"""
|
||||
Add a new request.
|
||||
@ -177,8 +170,6 @@ class RestClient(object):
|
||||
on_error,
|
||||
extra,
|
||||
)
|
||||
if json_str is not None:
|
||||
request.set_json(json_str)
|
||||
self._queue.put(request)
|
||||
return request
|
||||
|
||||
@ -262,7 +253,6 @@ class RestClient(object):
|
||||
headers=request.headers,
|
||||
params=request.params,
|
||||
data=request.data,
|
||||
json=request.json,
|
||||
proxies=self.proxies,
|
||||
)
|
||||
request.response = response
|
||||
|
Loading…
Reference in New Issue
Block a user