diff --git a/tests/network/RestfulClientTest.py b/tests/network/RestfulClientTest.py index 90d400c1..7de57c1c 100644 --- a/tests/network/RestfulClientTest.py +++ b/tests/network/RestfulClientTest.py @@ -6,18 +6,18 @@ import unittest from simplejson import JSONDecodeError from Promise import Promise -from vnpy.network.HttpClient import HttpClient, Request +from vnpy.network.RestClient import RestClient, Request class FailedError(RuntimeError): pass -class TestHttpClient(HttpClient): +class TestRestClient(RestClient): def __init__(self): urlBase = 'https://httpbin.org' - super(TestHttpClient, self).__init__() + super(TestRestClient, self).__init__() self.init(urlBase) self.p = Promise() @@ -37,7 +37,7 @@ class TestHttpClient(HttpClient): class RestfulClientTest(unittest.TestCase): def setUp(self): - self.c = TestHttpClient() + self.c = TestRestClient() self.c.start() def tearDown(self): diff --git a/vnpy/api/okexfuture/vnokexFuture.py b/vnpy/api/okexfuture/vnokexFuture.py index 263356b7..b32236e2 100644 --- a/vnpy/api/okexfuture/vnokexFuture.py +++ b/vnpy/api/okexfuture/vnokexFuture.py @@ -4,15 +4,15 @@ import urllib ######################################################################## -from vnpy.network.HttpClient import HttpClient, Request +from vnpy.network.RestClient import RestClient, Request ######################################################################## -class OkexFutureHttpClient(HttpClient): +class OkexFutureRestClient(RestClient): #---------------------------------------------------------------------- def __init__(self): - super(OkexFutureHttpClient, self).__init__() + super(OkexFutureRestClient, self).__init__() self.apiKey = None self.apiSecret = None @@ -20,7 +20,7 @@ class OkexFutureHttpClient(HttpClient): # noinspection PyMethodOverriding def init(self, apiKey, apiSecret): # type: (str, str) -> any - super(OkexFutureHttpClient, self).init('https://www.okex.com/api/v1') + super(OkexFutureRestClient, self).init('https://www.okex.com/api/v1') self.apiKey = apiKey self.apiSecret = apiSecret diff --git a/vnpy/network/HttpClient.py b/vnpy/network/RestClient.py similarity index 99% rename from vnpy/network/HttpClient.py rename to vnpy/network/RestClient.py index 0caf9366..65014392 100644 --- a/vnpy/network/HttpClient.py +++ b/vnpy/network/RestClient.py @@ -70,9 +70,9 @@ class Request(object): ######################################################################## -class HttpClient(object): +class RestClient(object): """ - HTTP 客户端。目前是为了对接各种RESTFulAPI而设计的。 + HTTP 客户端。目前是为了对接各种RESTfulAPI而设计的。 如果需要给请求加上签名,请重载beforeRequest函数。 如果需要处理非200的请求,请重载onFailed函数。 diff --git a/vnpy/trader/gateway/okexFutureGateway/okexFutureGateway.py b/vnpy/trader/gateway/okexFutureGateway/okexFutureGateway.py index b706634c..21d0cc2d 100644 --- a/vnpy/trader/gateway/okexFutureGateway/okexFutureGateway.py +++ b/vnpy/trader/gateway/okexFutureGateway/okexFutureGateway.py @@ -5,8 +5,8 @@ from __future__ import print_function import json from abc import abstractmethod, abstractproperty -from vnpy.api.okexfuture.vnokexFuture import OkexFutureHttpClient -from vnpy.network.HttpClient import Request +from vnpy.api.okexfuture.vnokexFuture import OkexFutureRestClient +from vnpy.network.RestClient import Request from vnpy.trader.vtFunction import getJsonPath from vnpy.trader.vtGateway import * @@ -351,7 +351,7 @@ class OkexFutureApi(ApiBase): self.gateway = gateway # type: OkexFutureGateway self.localID = 0 - self.client = OkexFutureHttpClient() + self.client = OkexFutureRestClient() #---------------------------------------------------------------------- def onOrderSent(self, data, req): # type: (dict, Request)->None