@@ -741,6 +741,7 @@ def __init__(self, app):
741
741
'GCLOUD_PROJECT environment variable.' )
742
742
self ._fcm_url = _MessagingService .FCM_URL .format (project_id )
743
743
self ._client = _http_client .JsonHttpClient (credential = app .credential .get_credential ())
744
+ self ._timeout = app .options .get ('httpTimeout' )
744
745
745
746
@classmethod
746
747
def encode_message (cls , message ):
@@ -753,7 +754,7 @@ def send(self, message, dry_run=False):
753
754
if dry_run :
754
755
data ['validate_only' ] = True
755
756
try :
756
- resp = self ._client .body ('post' , url = self ._fcm_url , json = data )
757
+ resp = self ._client .body ('post' , url = self ._fcm_url , json = data , timeout = self . _timeout )
757
758
except requests .exceptions .RequestException as error :
758
759
if error .response is not None :
759
760
self ._handle_fcm_error (error )
@@ -784,7 +785,12 @@ def make_topic_management_request(self, tokens, topic, operation):
784
785
url = '{0}/{1}' .format (_MessagingService .IID_URL , operation )
785
786
try :
786
787
resp = self ._client .body (
787
- 'post' , url = url , json = data , headers = _MessagingService .IID_HEADERS )
788
+ 'post' ,
789
+ url = url ,
790
+ json = data ,
791
+ headers = _MessagingService .IID_HEADERS ,
792
+ timeout = self ._timeout
793
+ )
788
794
except requests .exceptions .RequestException as error :
789
795
if error .response is not None :
790
796
self ._handle_iid_error (error )
0 commit comments