Skip to content
This repository has been archived by the owner on Mar 20, 2018. It is now read-only.

Remove oauth2client #176

Merged
merged 1 commit into from
Mar 27, 2017
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
94 changes: 0 additions & 94 deletions google/gax/_grpc_oauth2client.py

This file was deleted.

11 changes: 3 additions & 8 deletions google/gax/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@

from grpc import RpcError, StatusCode

# Preferentially use google-auth.
try:
from google.gax import _grpc_google_auth as _grpc_auth
# Fallback to oauth2client.
except ImportError:
from google.gax import _grpc_oauth2client as _grpc_auth
from google.gax import _grpc_google_auth


API_ERRORS = (RpcError, )
Expand Down Expand Up @@ -106,9 +101,9 @@ def create_stub(generated_create_stub, channel=None, service_path=None,
target = '{}:{}'.format(service_path, service_port)

if credentials is None:
credentials = _grpc_auth.get_default_credentials(scopes)
credentials = _grpc_google_auth.get_default_credentials(scopes)

channel = _grpc_auth.secure_authorized_channel(
channel = _grpc_google_auth.secure_authorized_channel(
credentials, target, ssl_credentials=ssl_credentials)

return generated_create_stub(channel)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
'future>=0.16.0, <0.17dev',
'googleapis-common-protos>=1.5.2, <2.0dev',
'grpcio>=1.0.2, <2.0dev',
'oauth2client>=2.0.0, <4.0dev',
'google-auth>=0.8.0, <2.0dev',
'ply==3.8',
'protobuf>=3.0.0, <4.0dev',
]
Expand Down
97 changes: 0 additions & 97 deletions tests/test__grpc_oauth2client.py

This file was deleted.

12 changes: 6 additions & 6 deletions tests/test_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class TestCreateStub(unittest2.TestCase):
FAKE_SERVICE_PATH = 'service_path'
FAKE_PORT = 10101

@mock.patch('google.gax.grpc._grpc_auth.get_default_credentials')
@mock.patch('google.gax.grpc._grpc_auth.secure_authorized_channel')
@mock.patch('google.gax._grpc_google_auth.get_default_credentials')
@mock.patch('google.gax._grpc_google_auth.secure_authorized_channel')
def test_creates_a_stub_with_default_credentials(
self, secure_authorized_channel, get_default_credentials):
fake_scopes = ['one', 'two']
Expand All @@ -63,8 +63,8 @@ def test_creates_a_stub_with_default_credentials(

self.assertEqual(got_channel, secure_authorized_channel.return_value)

@mock.patch('google.gax.grpc._grpc_auth.get_default_credentials')
@mock.patch('google.gax.grpc._grpc_auth.secure_authorized_channel')
@mock.patch('google.gax._grpc_google_auth.get_default_credentials')
@mock.patch('google.gax._grpc_google_auth.secure_authorized_channel')
def test_creates_a_stub_with_explicit_credentials(
self, secure_authorized_channel, get_default_credentials):
credentials = mock.Mock()
Expand All @@ -80,8 +80,8 @@ def test_creates_a_stub_with_explicit_credentials(

self.assertEqual(got_channel, secure_authorized_channel.return_value)

@mock.patch('google.gax.grpc._grpc_auth.get_default_credentials')
@mock.patch('google.gax.grpc._grpc_auth.secure_authorized_channel')
@mock.patch('google.gax._grpc_google_auth.get_default_credentials')
@mock.patch('google.gax._grpc_google_auth.secure_authorized_channel')
def test_creates_a_stub_with_given_channel(
self, secure_authorized_channel, get_default_credentials):
fake_channel = mock.Mock()
Expand Down