firebase_admin.remote_config module

Firebase Remote Config Module. This module has required APIs for the clients to use Firebase Remote Config with python.

Classes

CustomSignalOperator

classfirebase_admin.remote_config.CustomSignalOperator(*values)

Bases: Enum

Enum representing the available operators for custom signal conditions.

NUMERIC_EQUAL='NUMERIC_EQUAL'
NUMERIC_GREATER_EQUAL='NUMERIC_GREATER_EQUAL'
NUMERIC_GREATER_THAN='NUMERIC_GREATER_THAN'
NUMERIC_LESS_EQUAL='NUMERIC_LESS_EQUAL'
NUMERIC_LESS_THAN='NUMERIC_LESS_THAN'
NUMERIC_NOT_EQUAL='NUMERIC_NOT_EQUAL'
SEMANTIC_VERSION_EQUAL='SEMANTIC_VERSION_EQUAL'
SEMANTIC_VERSION_GREATER_EQUAL='SEMANTIC_VERSION_GREATER_EQUAL'
SEMANTIC_VERSION_GREATER_THAN='SEMANTIC_VERSION_GREATER_THAN'
SEMANTIC_VERSION_LESS_EQUAL='SEMANTIC_VERSION_LESS_EQUAL'
SEMANTIC_VERSION_LESS_THAN='SEMANTIC_VERSION_LESS_THAN'
SEMANTIC_VERSION_NOT_EQUAL='SEMANTIC_VERSION_NOT_EQUAL'
STRING_CONTAINS='STRING_CONTAINS'
STRING_CONTAINS_REGEX='STRING_CONTAINS_REGEX'
STRING_DOES_NOT_CONTAIN='STRING_DOES_NOT_CONTAIN'
STRING_EXACTLY_MATCHES='STRING_EXACTLY_MATCHES'
UNKNOWN='UNKNOWN'

PercentConditionOperator

classfirebase_admin.remote_config.PercentConditionOperator(*values)

Bases: Enum

Enum representing the available operators for percent conditions.

BETWEEN='BETWEEN'
GREATER_THAN='GREATER_THAN'
LESS_OR_EQUAL='LESS_OR_EQUAL'
UNKNOWN='UNKNOWN'

ServerConfig

classfirebase_admin.remote_config.ServerConfig(config_values)

Bases: object

Represents a Remote Config Server Side Config.

get_boolean(key)

Returns the value as a boolean.

get_float(key)

Returns the value as a float.

get_int(key)

Returns the value as an integer.

get_string(key)

Returns the value as a string.

get_value_source(key)

Returns the source of the value.

ServerTemplate

classfirebase_admin.remote_config.ServerTemplate(app:App=None, default_config:Dict[str,str]|None=None)

Bases: object

Represents a Server Template with implementations for loading and evaluating the template.

evaluate(context:Dict[str,str|int]|None=None)ServerConfig

Evaluates the cached server template to produce a ServerConfig.

Parameters:

context – A dictionary of values to use for evaluating conditions.

Returns:

A ServerConfig object.

Raises:

ValueError – If the input arguments are invalid.

asyncload()

Fetches the server template and caches the data.

set(template_data_json:str)

Updates the cache to store the given template is of type ServerTemplateData.

Parameters:

template_data_json – A json string representing ServerTemplateData to be cached.

to_json()

Provides the server template in a JSON format to be used for initialization later.

Functions

get_server_template

asyncfirebase_admin.remote_config.get_server_template(app:App=None, default_config:Dict[str,str]|None=None)

Initializes a new ServerTemplate instance and fetches the server template.

Parameters:
  • app – App instance to be used. This is optional and the default app instance will be used if not present.

  • default_config – The default config to be used in the evaluated config.

Returns:

An object having the cached server template to be used for evaluation.

Return type:

ServerTemplate

init_server_template

firebase_admin.remote_config.init_server_template(app:App=None, default_config:Dict[str,str]|None=None, template_data_json:str|None=None)

Initializes a new ServerTemplate instance.

Parameters:
  • app – App instance to be used. This is optional and the default app instance will be used if not present.

  • default_config – The default config to be used in the evaluated config.

  • template_data_json – An optional template data JSON to be set on initialization.

Returns:

A new ServerTemplate instance initialized with an optional template and config.

Return type:

ServerTemplate