Skip to content

Commit

Permalink
feat: support http protocol schema
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfan committed May 4, 2020
1 parent e4153da commit 4e6ea30
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Installation
| Download code
| python setup.py install
| pip install
| pip install dubbo-python3>=1.0.1 Git install
| pip install git+\ https://github.com/nickfan/[email protected].1
| pip install dubbo-python3>=1.0.2 Git install
| pip install git+https://github.com/nickfan/[email protected].2
Load balancing on the client side, service discovery
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
6 changes: 3 additions & 3 deletions dubbo_client/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def _compare_swap_nodes(self, interface, nodes):
for child_node in nodes:
node = urllib.parse.unquote(child_node)
logger.debug('child of node is {0}'.format(node))
if node.startswith('jsonrpc'):
if node.startswith('jsonrpc') or node.startswith('http'):
service_url = ServiceURL(node)
self._add_node(interface, service_url)
except Exception as e:
Expand Down Expand Up @@ -399,12 +399,12 @@ def __init__(self, address, application_config=None):
def _do_event(self, event):
if event.startswith('register'):
url = event[9:]
if url.startswith('jsonrpc'):
if url.startswith('jsonrpc') or url.startswith('http'):
service_provide = ServiceURL(url)
self._add_node(service_provide.interface, service_provide)
if event.startswith('unregister'):
url = event[11:]
if url.startswith('jsonrpc'):
if url.startswith('jsonrpc') or url.startswith('http'):
service_provide = ServiceURL(url)
self._remove_node(service_provide.interface, service_provide)

Expand Down
1 change: 1 addition & 0 deletions dubbo_client/rpclib.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def call(self, method, *args, **kwargs):
provider = self.registry.get_random_provider(self.interface, version=self.version, group=self.group)
# print service_url.location
url = "http://{0}{1}".format(provider.location, provider.path)
# print(url)
client = HTTPClient(url)
try:
response = client.request(method, *args, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.1
1.0.2

0 comments on commit 4e6ea30

Please sign in to comment.