File tree 1 file changed +13
-7
lines changed
1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change 18
18
import os
19
19
import sys
20
20
21
- try :
22
- from google .cloud .logging_v2 import _gapic
23
- except ImportError : # pragma: NO COVER
24
- _HAVE_GRPC = False
25
- _gapic = None
26
- else :
27
- _HAVE_GRPC = True
28
21
29
22
import google .api_core .client_options
30
23
from google .cloud .client import ClientWithProject
48
41
49
42
50
43
_DISABLE_GRPC = os .getenv (DISABLE_GRPC , False )
44
+ _HAVE_GRPC = False
45
+
46
+ try :
47
+ if not _DISABLE_GRPC :
48
+ # only import if DISABLE_GRPC is not set
49
+ from google .cloud .logging_v2 import _gapic
50
+
51
+ _HAVE_GRPC = True
52
+ except ImportError : # pragma: NO COVER
53
+ # could not import gapic library. Fall back to HTTP mode
54
+ _HAVE_GRPC = False
55
+ _gapic = None
56
+
51
57
_USE_GRPC = _HAVE_GRPC and not _DISABLE_GRPC
52
58
53
59
_GAE_RESOURCE_TYPE = "gae_app"
You can’t perform that action at this time.
0 commit comments