Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hhhrrrttt222111
GitHub Repository: hhhrrrttt222111/Dorkify
Path: blob/master/venv/Lib/site-packages/urllib3/contrib/_appengine_environ.py
811 views
1
"""
2
This module provides means to detect the App Engine environment.
3
"""
4
5
import os
6
7
8
def is_appengine():
9
return is_local_appengine() or is_prod_appengine()
10
11
12
def 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
22
def is_local_appengine():
23
return "APPENGINE_RUNTIME" in os.environ and os.environ.get(
24
"SERVER_SOFTWARE", ""
25
).startswith("Development/")
26
27
28
def is_prod_appengine():
29
return "APPENGINE_RUNTIME" in os.environ and os.environ.get(
30
"SERVER_SOFTWARE", ""
31
).startswith("Google App Engine/")
32
33
34
def is_prod_appengine_mvms():
35
"""Deprecated."""
36
return False
37
38