2222from google .pubsub .v1 .pubsub_pb2 import PushConfig
2323from grpc import insecure_channel
2424from grpc import StatusCode
25- from grpc ._channel import _Rendezvous
2625
2726# pylint: disable=ungrouped-imports
2827from google .cloud ._helpers import _to_bytes
2928from google .cloud ._helpers import _pb_timestamp_to_rfc3339
3029from google .cloud .exceptions import Conflict
30+ from google .cloud .exceptions import GrpcRendezvous
3131from google .cloud .exceptions import NotFound
3232# pylint: enable=ungrouped-imports
3333
@@ -92,7 +92,7 @@ def topic_create(self, topic_path):
9292 """
9393 try :
9494 topic_pb = self ._gax_api .create_topic (topic_path )
95- except _Rendezvous as exc :
95+ except GrpcRendezvous as exc :
9696 if exc .code () == StatusCode .FAILED_PRECONDITION :
9797 raise Conflict (topic_path )
9898 raise
@@ -115,7 +115,7 @@ def topic_get(self, topic_path):
115115 """
116116 try :
117117 topic_pb = self ._gax_api .get_topic (topic_path )
118- except _Rendezvous as exc :
118+ except GrpcRendezvous as exc :
119119 if exc .code () == StatusCode .NOT_FOUND :
120120 raise NotFound (topic_path )
121121 raise
@@ -133,7 +133,7 @@ def topic_delete(self, topic_path):
133133 """
134134 try :
135135 self ._gax_api .delete_topic (topic_path )
136- except _Rendezvous as exc :
136+ except GrpcRendezvous as exc :
137137 if exc .code () == StatusCode .NOT_FOUND :
138138 raise NotFound (topic_path )
139139 raise
@@ -162,7 +162,7 @@ def topic_publish(self, topic_path, messages):
162162 try :
163163 result = self ._gax_api .publish (topic_path , message_pbs ,
164164 options = options )
165- except _Rendezvous as exc :
165+ except GrpcRendezvous as exc :
166166 if exc .code () == StatusCode .NOT_FOUND :
167167 raise NotFound (topic_path )
168168 raise
@@ -200,7 +200,7 @@ def topic_list_subscriptions(self, topic_path, page_size=0,
200200 try :
201201 page_iter = self ._gax_api .list_topic_subscriptions (
202202 topic_path , page_size = page_size , options = options )
203- except _Rendezvous as exc :
203+ except GrpcRendezvous as exc :
204204 if exc .code () == StatusCode .NOT_FOUND :
205205 raise NotFound (topic_path )
206206 raise
@@ -293,7 +293,7 @@ def subscription_create(self, subscription_path, topic_path,
293293 try :
294294 sub_pb = self ._gax_api .create_subscription (
295295 subscription_path , topic_path , push_config , ack_deadline )
296- except _Rendezvous as exc :
296+ except GrpcRendezvous as exc :
297297 if exc .code () == StatusCode .FAILED_PRECONDITION :
298298 raise Conflict (topic_path )
299299 raise
@@ -315,7 +315,7 @@ def subscription_get(self, subscription_path):
315315 """
316316 try :
317317 sub_pb = self ._gax_api .get_subscription (subscription_path )
318- except _Rendezvous as exc :
318+ except GrpcRendezvous as exc :
319319 if exc .code () == StatusCode .NOT_FOUND :
320320 raise NotFound (subscription_path )
321321 raise
@@ -334,7 +334,7 @@ def subscription_delete(self, subscription_path):
334334 """
335335 try :
336336 self ._gax_api .delete_subscription (subscription_path )
337- except _Rendezvous as exc :
337+ except GrpcRendezvous as exc :
338338 if exc .code () == StatusCode .NOT_FOUND :
339339 raise NotFound (subscription_path )
340340 raise
@@ -359,7 +359,7 @@ def subscription_modify_push_config(self, subscription_path,
359359 push_config = PushConfig (push_endpoint = push_endpoint )
360360 try :
361361 self ._gax_api .modify_push_config (subscription_path , push_config )
362- except _Rendezvous as exc :
362+ except GrpcRendezvous as exc :
363363 if exc .code () == StatusCode .NOT_FOUND :
364364 raise NotFound (subscription_path )
365365 raise
@@ -391,7 +391,7 @@ def subscription_pull(self, subscription_path, return_immediately=False,
391391 try :
392392 response_pb = self ._gax_api .pull (
393393 subscription_path , max_messages , return_immediately )
394- except _Rendezvous as exc :
394+ except GrpcRendezvous as exc :
395395 if exc .code () == StatusCode .NOT_FOUND :
396396 raise NotFound (subscription_path )
397397 raise
@@ -414,7 +414,7 @@ def subscription_acknowledge(self, subscription_path, ack_ids):
414414 """
415415 try :
416416 self ._gax_api .acknowledge (subscription_path , ack_ids )
417- except _Rendezvous as exc :
417+ except GrpcRendezvous as exc :
418418 if exc .code () == StatusCode .NOT_FOUND :
419419 raise NotFound (subscription_path )
420420 raise
@@ -441,7 +441,7 @@ def subscription_modify_ack_deadline(self, subscription_path, ack_ids,
441441 try :
442442 self ._gax_api .modify_ack_deadline (
443443 subscription_path , ack_ids , ack_deadline )
444- except _Rendezvous as exc :
444+ except GrpcRendezvous as exc :
445445 if exc .code () == StatusCode .NOT_FOUND :
446446 raise NotFound (subscription_path )
447447 raise
0 commit comments