Skip to content
Browse files
  • Loading branch information
JoeCao committed Apr 9, 2015
1 parent 3e54e8e commit 70da96c832f53a87799b874cc89733db922037e4
Showing 1 changed file with 4 additions and 7 deletions.
@@ -1,12 +1,8 @@
# coding=utf-8
import random
from urllib2 import HTTPError

from pyjsonrpc import HttpClient, JsonRpcError

from dubbo_client.rpcerror import NoProvider, ConnectionFail, dubbo_client_errors

from dubbo_client.rpcerror import NoProvider, ConnectionFail, dubbo_client_errors, InternalError
__author__ = 'caozupeng'

@@ -32,14 +28,15 @@ def call(self, method, *args, **kwargs):
if len(provides) == 0:
raise NoProvider('can not find provide', self.interface)
location, provide = random.choice(provides.items())
print 'location is {0}'.format(location)
client = HttpClient(url="http://{0}{1}".format(location, provide.path))
return, *args, **kwargs)
except HTTPError, e:
raise ConnectionFail(None, e.filename)
except JsonRpcError, error:
raise dubbo_client_errors.get(error.code, None)
except Exception, ue:
raise InternalError(ue.message, None)

def __call__(self, method, *args, **kwargs):

0 comments on commit 70da96c

Please sign in to comment.