Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap target, request for request, target in secure_authorized_channel's argument order. #81

Merged
merged 2 commits into from
Nov 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/user-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ this is to use google-auth to create the gRPC channel::
http_request = google.auth.transport.requests.Request()

channel = google.auth.transport.grpc.secure_authorized_channel(
credentials, 'pubsub.googleapis.com:443', http_request)
credentials, http_request, 'pubsub.googleapis.com:443')

.. note:: Even though gRPC is its own transport, you still need to use one of
the other HTTP transports with gRPC. The reason is that most credential
Expand Down
4 changes: 2 additions & 2 deletions google/auth/transport/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __call__(self, context, callback):


def secure_authorized_channel(
credentials, target, request, ssl_credentials=None):
credentials, request, target, ssl_credentials=None):
"""Creates a secure authorized gRPC channel.

This creates a channel with SSL and :class:`AuthMetadataPlugin`. This
Expand Down Expand Up @@ -91,11 +91,11 @@ def secure_authorized_channel(
Args:
credentials (google.auth.credentials.Credentials): The credentials to
add to requests.
target (str): The host and port of the service.
request (google.auth.transport.Request): A HTTP transport request
object used to refresh credentials as needed. Even though gRPC
is a separate transport, there's no way to refresh the credentials
without using a standard http transport.
target (str): The host and port of the service.
ssl_credentials (grpc.ChannelCredentials): Optional SSL channel
credentials. This can be used to specify different certificates.

Expand Down
2 changes: 1 addition & 1 deletion system_tests/test_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_grpc_request(http_request):
publisher_api.PublisherApi.DEFAULT_SERVICE_PORT)

channel = google.auth.transport.grpc.secure_authorized_channel(
credentials, target, http_request)
credentials, http_request, target)

# Create a pub/sub client.
client = publisher_api.PublisherApi(channel=channel)
Expand Down
4 changes: 2 additions & 2 deletions tests/transport/test_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_secure_authorized_channel(
target = 'example.com:80'

channel = google.auth.transport.grpc.secure_authorized_channel(
credentials, target, request)
credentials, request, target)

# Check the auth plugin construction.
auth_plugin = metadata_call_credentials.call_args[0][0]
Expand Down Expand Up @@ -118,7 +118,7 @@ def test_secure_authorized_channel_explicit_ssl(
ssl_credentials = mock.Mock()

google.auth.transport.grpc.secure_authorized_channel(
credentials, target, request, ssl_credentials=ssl_credentials)
credentials, request, target, ssl_credentials=ssl_credentials)

# Check the ssl channel call.
assert not ssl_channel_credentials.called
Expand Down