google.appengine.api.conf module
Summary
A library for managing flags-like configuration that update dynamically.
Contents
- class google.appengine.api.conf.Config(parent=None, key_name=None, _app=None, **kwds)source
-
Bases: google.appengine.ext.db.Expando
The representation of a config in the datastore and memcache.
- ah__conf__load_from_yaml(parsed_config)source
Loads all the params from a YAMLConfiguration into expando fields.
We set these expando properties with a special name prefix โp_โ to keep them separate from the static attributes of Config. That way we donโt have to check elsewhere to make sure the user doesnโt stomp on our built in properties.
Parametersparse_config โ A YAMLConfiguration.
- ah__conf__version
-
An integer property.
- classmethod kind()source
-
Override the kind name to prevent collisions with users.
- google.appengine.api.conf.LoadSingleConf(stream)source
Load a conf.yaml file or string and return a YAMLConfiguration object.
Parametersstream โ a file object corresponding to a conf.yaml file, or its contents as a string.
ReturnsA YAMLConfiguration instance
- class google.appengine.api.conf.YAMLConfiguration(**attributes)source
Bases: google.appengine.api.validation.Validated
This class describes the structure of a conf.yaml file.
At the top level the file should have a params attribue which is a mapping from strings to scalars. For example:
Parameters-
background_color โ โredโ
-
message_size โ 1024
-
boolean_valued_param โ true
- ATTRIBUTES = {'parameters': <class 'google.appengine.api.conf._ParameterDict'>}
-
- google.appengine.api.conf.get(name, default=None)source
Get the value of a configuration parameter.
This function is guaranteed to return the same value for every call during a single request.
Parameters-
name โ The name of the configuration parameter you want a value for.
-
default โ A default value to return if the named parameter doesnโt exist.
The string value of the configuration parameter.
-
- google.appengine.api.conf.get_all()source
Return an object with an attribute for each conf parameter.
ReturnsAn object with an attribute for each conf parameter.
- google.appengine.api.conf.refresh()source
-
Update the local config cache from memcache/datastore.
Normally configuration parameters are only refreshed at the start of a new request. If you have a very long running request, or you just need the freshest data for some reason, you can call this function to force a refresh.