3030except ImportError :
3131 app_identity = None
3232try :
33- from grpc . beta import implementations
33+ import grpc
3434except ImportError : # pragma: NO COVER
35- implementations = None
35+ grpc = None
3636import six
3737from six .moves .http_client import HTTPConnection
3838from six .moves import configparser
@@ -572,10 +572,10 @@ def __call__(self, unused_context, callback):
572572 callback (headers , None )
573573
574574
575- def make_stub (credentials , user_agent , stub_factory , host , port ):
575+ def make_stub (credentials , user_agent , stub_class , host , port ):
576576 """Makes a stub for an RPC service.
577577
578- Uses / depends on the beta implementation of gRPC.
578+ Uses / depends on gRPC.
579579
580580 :type credentials: :class:`oauth2client.client.OAuth2Credentials`
581581 :param credentials: The OAuth2 Credentials to use for creating
@@ -584,29 +584,29 @@ def make_stub(credentials, user_agent, stub_factory, host, port):
584584 :type user_agent: str
585585 :param user_agent: (Optional) The user agent to be used with API requests.
586586
587- :type stub_factory: callable
588- :param stub_factory: A factory which will create a gRPC stub for
589- a given service.
587+ :type stub_class: type
588+ :param stub_class: A gRPC stub type for a given service.
590589
591590 :type host: str
592591 :param host: The host for the service.
593592
594593 :type port: int
595594 :param port: The port for the service.
596595
597- :rtype: :class:`grpc.beta._stub._AutoIntermediary `
596+ :rtype: object, instance of ``stub_class` `
598597 :returns: The stub object used to make gRPC requests to a given API.
599598 """
600599 # Leaving the first argument to ssl_channel_credentials() as None
601600 # loads root certificates from `grpc/_adapter/credentials/roots.pem`.
602- transport_creds = implementations .ssl_channel_credentials (None , None , None )
601+ transport_creds = grpc .ssl_channel_credentials (None , None , None )
603602 custom_metadata_plugin = MetadataPlugin (credentials , user_agent )
604- auth_creds = implementations .metadata_call_credentials (
603+ auth_creds = grpc .metadata_call_credentials (
605604 custom_metadata_plugin , name = 'google_creds' )
606- channel_creds = implementations .composite_channel_credentials (
605+ channel_creds = grpc .composite_channel_credentials (
607606 transport_creds , auth_creds )
608- channel = implementations .secure_channel (host , port , channel_creds )
609- return stub_factory (channel )
607+ target = '%s:%d' % (host , port )
608+ channel = grpc .secure_channel (target , channel_creds )
609+ return stub_class (channel )
610610
611611
612612try :
0 commit comments