[Mod] HttpClient改名为RestClient

This commit is contained in:
nanoric 2018-10-10 05:36:00 -04:00
parent f0aa9c7172
commit e6f7781a47
4 changed files with 13 additions and 13 deletions

View File

@ -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):

View File

@ -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

View File

@ -70,9 +70,9 @@ class Request(object):
########################################################################
class HttpClient(object):
class RestClient(object):
"""
HTTP 客户端目前是为了对接各种RESTFulAPI而设计的
HTTP 客户端目前是为了对接各种RESTfulAPI而设计的
如果需要给请求加上签名请重载beforeRequest函数
如果需要处理非200的请求请重载onFailed函数

View File

@ -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