trap requests timeout error (#1607)
This commit is contained in:
parent
46af8b7956
commit
91f71fef68
|
@ -29,6 +29,7 @@ import warnings
|
|||
|
||||
import click
|
||||
import google.auth
|
||||
import requests.exceptions
|
||||
|
||||
from google.auth.transport.requests import AuthorizedSession
|
||||
|
||||
|
@ -123,7 +124,8 @@ def fetch(request, delete=False):
|
|||
else:
|
||||
response = HTTP.post(request.url, headers=request.headers,
|
||||
data=json.dumps(request.data))
|
||||
except google.auth.exceptions.RefreshError as e:
|
||||
except (google.auth.exceptions.RefreshError,
|
||||
requests.exceptions.ReadTimeout) as e:
|
||||
raise SystemExit(e.args[0])
|
||||
try:
|
||||
rdata = json.loads(response.content)
|
||||
|
|
|
@ -2,3 +2,4 @@ click
|
|||
functions-framework
|
||||
google-api-core
|
||||
google-cloud-monitoring
|
||||
requests
|
Loading…
Reference in New Issue