This repository was archived by the owner on Apr 14, 2022. It is now read-only.
File tree 2 files changed +14
-17
lines changed
2 files changed +14
-17
lines changed Original file line number Diff line number Diff line change 6
6
7
7
8
8
def is_appengine ():
9
- return is_local_appengine () or is_prod_appengine () or is_prod_appengine_mvms ()
9
+ return "APPENGINE_RUNTIME" in os . environ
10
10
11
11
12
12
def is_appengine_sandbox ():
13
- return is_appengine () and not is_prod_appengine_mvms ()
13
+ """Reports if the app is running in the first generation sandbox.
14
+
15
+ The second generation runtimes are technically still in a sandbox, but it
16
+ is much less restrictive, so generally you shouldn't need to check for it.
17
+ see https://cloud.google.com/appengine/docs/standard/runtimes
18
+ """
19
+ return is_appengine () and os .environ ["APPENGINE_RUNTIME" ] == "python27"
14
20
15
21
16
22
def is_local_appengine ():
17
- return (
18
- "APPENGINE_RUNTIME" in os .environ
19
- and "Development/" in os .environ ["SERVER_SOFTWARE" ]
23
+ return is_appengine () and os .environ .get ("SERVER_SOFTWARE" , "" ).startswith (
24
+ "Development/"
20
25
)
21
26
22
27
23
28
def is_prod_appengine ():
24
- return (
25
- "APPENGINE_RUNTIME" in os .environ
26
- and "Google App Engine/" in os .environ ["SERVER_SOFTWARE" ]
27
- and not is_prod_appengine_mvms ()
29
+ return is_appengine () and os .environ .get ("SERVER_SOFTWARE" , "" ).startswith (
30
+ "Google App Engine/"
28
31
)
29
32
30
33
31
34
def is_prod_appengine_mvms ():
32
- return os .environ .get ("GAE_VM" , False ) == "true"
35
+ """Deprecated."""
36
+ return False
Original file line number Diff line number Diff line change @@ -108,13 +108,6 @@ def __init__(
108
108
"URLFetch is not available in this environment."
109
109
)
110
110
111
- if is_prod_appengine_mvms ():
112
- raise AppEnginePlatformError (
113
- "Use normal urllib3.PoolManager instead of AppEngineManager"
114
- "on Managed VMs, as using URLFetch is not necessary in "
115
- "this environment."
116
- )
117
-
118
111
warnings .warn (
119
112
"urllib3 is using URLFetch on Google App Engine sandbox instead "
120
113
"of sockets. To use sockets directly instead of URLFetch see "
You can’t perform that action at this time.
0 commit comments