Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/urllib3/contrib/_appengine_environ.py: 91%

11 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2023-07-17 14:22 -0600

1""" 

2This module provides means to detect the App Engine environment. 

3""" 

4 

5import os 

6 

7 

8def is_appengine(): 

9 return is_local_appengine() or is_prod_appengine() 

10 

11 

12def is_appengine_sandbox(): 

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" 

20 

21 

22def is_local_appengine(): 

23 return "APPENGINE_RUNTIME" in os.environ and os.environ.get( 

24 "SERVER_SOFTWARE", "" 

25 ).startswith("Development/") 

26 

27 

28def is_prod_appengine(): 

29 return "APPENGINE_RUNTIME" in os.environ and os.environ.get( 

30 "SERVER_SOFTWARE", "" 

31 ).startswith("Google App Engine/") 

32 

33 

34def is_prod_appengine_mvms(): 

35 """Deprecated.""" 

36 return False