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)