aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio/grpc/beta
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-05-03 16:03:35 -0700
committerGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-05-03 16:03:35 -0700
commit442bead4a38cecb7f523e17a03df011028f1e925 (patch)
treebf119f20bd86c043fdb93f6d551e4e9edddc13ee /src/python/grpcio/grpc/beta
parent5a779537f1569d369980d20ebf6277f0bc2271ba (diff)
parente73e9e1a98600dfbf405c9bcbbfdcd4bd05d78f4 (diff)
Merge pull request #5701 from bluecmd/unix-socket
Allow directly specifiying connection path
Diffstat (limited to 'src/python/grpcio/grpc/beta')
-rw-r--r--src/python/grpcio/grpc/beta/implementations.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/python/grpcio/grpc/beta/implementations.py b/src/python/grpcio/grpc/beta/implementations.py
index 742e94dc65..822f593323 100644
--- a/src/python/grpcio/grpc/beta/implementations.py
+++ b/src/python/grpcio/grpc/beta/implementations.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -188,12 +188,13 @@ def insecure_channel(host, port):
Args:
host: The name of the remote host to which to connect.
port: The port of the remote host to which to connect.
+ If None only the 'host' part will be used.
Returns:
A Channel to the remote host through which RPCs may be conducted.
"""
intermediary_low_channel = _intermediary_low.Channel(
- '%s:%d' % (host, port), None)
+ '%s:%d' % (host, port) if port else host, None)
return Channel(intermediary_low_channel._internal, intermediary_low_channel) # pylint: disable=protected-access
@@ -203,13 +204,15 @@ def secure_channel(host, port, channel_credentials):
Args:
host: The name of the remote host to which to connect.
port: The port of the remote host to which to connect.
+ If None only the 'host' part will be used.
channel_credentials: A ChannelCredentials.
Returns:
A secure Channel to the remote host through which RPCs may be conducted.
"""
intermediary_low_channel = _intermediary_low.Channel(
- '%s:%d' % (host, port), channel_credentials._low_credentials)
+ '%s:%d' % (host, port) if port else host,
+ channel_credentials._low_credentials)
return Channel(intermediary_low_channel._internal, intermediary_low_channel) # pylint: disable=protected-access