コード例 #1
0
ファイル: rpclib.py プロジェクト: dubbo-x/dubbo-client-py
 def call(self, method, *args, **kwargs):
     provider = self.registry.get_random_provider(self.interface, version=self.version, group=self.group)
     client = HttpClient(url="http://{0}{1}".format(provider.location, provider.path))
     try:
         return client.call(method, *args, **kwargs)
     except HTTPError, e:
         raise ConnectionFail(None, e.filename)
コード例 #2
0
def test_client_every_new():
    user_provider = HttpClient(url="http://{0}{1}".format('zookeeper:38081/', 'com.ofpay.demo.api.UserProvider2'))
    print user_provider.getUser('A003')
    print user_provider.queryUser(
        {u'age': 18, u'time': 1428463514153, u'sex': u'MAN', u'id': u'A003', u'name': u'zhangsan'})
    print user_provider.queryAll()
    print user_provider.isLimit('MAN', 'Joe')
    print user_provider('getUser', 'A005')
コード例 #3
0
ファイル: rpclib.py プロジェクト: pyxixi2012/dubbo-client-py
 def call(self, method, *args, **kwargs):
     provides = self.registry.get_provides(self.interface, version=self.version, group=self.group)
     if len(provides) == 0:
         raise NoProvider('can not find provide', self.interface)
     ip_port, service_url = random.choice(provides.items())
     # print service_url.location
     client = HttpClient(url="http://{0}{1}".format(ip_port, service_url.path))
     try:
         return client.call(method, *args, **kwargs)
     except HTTPError, e:
         raise ConnectionFail(None, e.filename)
コード例 #4
0
def test_client_every_new():
    user_provider = HttpClient(url="http://{0}{1}".format('zookeeper:38081/', 'com.ofpay.demo.api.UserProvider2'))
    print user_provider.getUser('A003')
    print user_provider.queryUser(
        {u'age': 18, u'time': 1428463514153, u'sex': u'MAN', u'id': u'A003', u'name': u'zhangsan'})
    print user_provider.queryAll()
    print user_provider.isLimit('MAN', 'Joe')
    print user_provider('getUser', 'A005')
コード例 #5
0
ファイル: rpclib.py プロジェクト: yinwer81/dubbo-client-py
 def call(self, method, *args, **kwargs):
     provides = self.registry.get_provides(self.interface,
                                           version=self.version,
                                           group=self.group)
     if len(provides) == 0:
         raise NoProvider('can not find provide', self.interface)
     ip_port, service_url = random.choice(provides.items())
     # print service_url.location
     client = HttpClient(
         url="http://{0}{1}".format(ip_port, service_url.path))
     try:
         return client.call(method, *args, **kwargs)
     except HTTPError, e:
         raise ConnectionFail(None, e.filename)
コード例 #6
0
ファイル: res_company.py プロジェクト: mwithi/printer_proxy
    def print_labels(self, cr, uid, ids, b64_data, data_format="epl2", context=None):
        if not b64_data:
            return False

        for company in self.browse(cr, uid, ids, context=context):
            api = HttpClient(
                url=company.printer_proxy_url,
                username=company.printer_proxy_username,
                password=company.printer_proxy_password
            )

            api.call("output", printer_name=company.printer_proxy_device_name,
                     data=b64_data, format=data_format)

        return True
コード例 #7
0
def get_client():
    config = get_config()
    rpcport = int(config.get("rpcport", 8732))
    user = config.get("rpcuser")
    password = config.get("rpcpassword")
    host = config.get("rpchost", "localhost")
    return HttpClient(url="http://" + host + ":" + str(rpcport),
                      username=user,
                      password=password)
コード例 #8
0
def test_client():
    user_provider = HttpClient(url="http://{0}{1}".format('172.19.3.111:38080/', 'com.ofpay.demo.api.UserProvider'))
    for x in range(number):
        user_provider.getUser('A003')
        user_provider.queryUser(
            {u'age': 18, u'time': 1428463514153, u'sex': u'MAN', u'id': u'A003', u'name': u'zhangsan'})
        # user_provider.queryAll()
        user_provider.isLimit('MAN', 'Joe')
        user_provider('getUser', 'A005')
コード例 #9
0
def test_client():
    user_provider = HttpClient(url="http://{0}{1}".format(
        '172.19.3.111:38080/', 'com.ofpay.demo.api.UserProvider'))
    for x in range(number):
        user_provider.getUser('A003')
        user_provider.queryUser({
            u'age': 18,
            u'time': 1428463514153,
            u'sex': u'MAN',
            u'id': u'A003',
            u'name': u'zhangsan'
        })
        # user_provider.queryAll()
        user_provider.isLimit('MAN', 'Joe')
        user_provider('getUser', 'A005')
コード例 #10
0
ファイル: payout.py プロジェクト: yonnn/proxypool
 def walletcmd(self, method, *params):
     return HttpClient(**self.walletcfg).call(method, *params)
コード例 #11
0
ファイル: sharelogger.py プロジェクト: yonnn/proxypool
 def walletcmd(self, wallet, method, *params):
     return HttpClient(**wallet).call(method, *params)