"Fossies" - the Fresh Open Source Software Archive

Member "dmelt/lib/jython/Lib/site-packages/pip/_vendor/urllib3/contrib/_appengine_environ.py" (22 Jun 2022, 717 Bytes) of package /linux/misc/dmelt-2.8.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    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
   10             is_prod_appengine() or
   11             is_prod_appengine_mvms())
   12 
   13 
   14 def is_appengine_sandbox():
   15     return is_appengine() and not is_prod_appengine_mvms()
   16 
   17 
   18 def is_local_appengine():
   19     return ('APPENGINE_RUNTIME' in os.environ and
   20             'Development/' in os.environ['SERVER_SOFTWARE'])
   21 
   22 
   23 def is_prod_appengine():
   24     return ('APPENGINE_RUNTIME' in os.environ and
   25             'Google App Engine/' in os.environ['SERVER_SOFTWARE'] and
   26             not is_prod_appengine_mvms())
   27 
   28 
   29 def is_prod_appengine_mvms():
   30     return os.environ.get('GAE_VM', False) == 'true'