From 874bc7e4edd58096032355eeac9bae9a9d337430 Mon Sep 17 00:00:00 2001 From: 1122455801 Date: Tue, 18 Jun 2019 14:32:56 +0800 Subject: [PATCH] Update rest_client.py --- vnpy/api/rest/rest_client.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vnpy/api/rest/rest_client.py b/vnpy/api/rest/rest_client.py index 7bd4568e..646c894e 100644 --- a/vnpy/api/rest/rest_client.py +++ b/vnpy/api/rest/rest_client.py @@ -6,7 +6,7 @@ from datetime import datetime from enum import Enum from multiprocessing.dummy import Pool from queue import Empty, Queue -from typing import Any, Callable, Optional +from typing import Any, Callable, Optional, Union import requests @@ -28,7 +28,7 @@ class Request(object): method: str, path: str, params: dict, - data: dict, + data: Union[dict, str, bytes], headers: dict, callback: Callable = None, on_failed: Callable = None, @@ -140,7 +140,7 @@ class RestClient(object): path: str, callback: Callable, params: dict = None, - data: dict = None, + data: Union[dict, str, bytes] = None, headers: dict = None, on_failed: Callable = None, on_error: Callable = None, @@ -152,7 +152,7 @@ class RestClient(object): :param path: :param callback: callback function if 2xx status, type: (dict, Request) :param params: dict for query string - :param data: dict for body + :param data: Http body. If it is a dict, it will be converted to form-data. Otherwise, it will be converted to bytes. :param headers: dict for headers :param on_failed: callback function if Non-2xx status, type, type: (code, dict, Request) :param on_error: callback function when catching Python exception, type: (etype, evalue, tb, Request)