Firebase Remote Config SDK
Project description
Firebase Remote Config SDK for Python
A Python SDK for managing Firebase Remote Config via REST API. This package provides a convenient way to interact with Firebase Remote Config programmatically.
Features
- Get and update Remote Config templates
- Validate Remote Config changes before deployment
- List and rollback to previous versions
- Full support for all Remote Config features including parameters, conditions, and version management
- Type-safe with Pydantic models
Installation
pip install firebase-remote-config
Requirements
- Python 3.9 or higher
- Firebase project with Remote Config enabled
- Service account credentials with Firebase Remote Config admin permissions
Usage
Getting Started
First, initialize the client with your Firebase credentials:
from google.oauth2 import service_account
from firebase_remote_config import RemoteConfigClient
# Initialize the client
credentials = service_account.Credentials.from_service_account_file('path/to/service-account.json')
client = RemoteConfigClient(credentials, 'your-project-id')
# Get current Remote Config template
config = client.get_remote_config()
# Upload template to Firebase Remote Config
updated_config = client.update_remote_config(config)
Use Cases
1. Creating and Updating Parameters
from firebase_remote_config import RemoteConfigParameter, TagColor
# Add new parameter to the remote config template
new_param = RemoteConfigParameter(
defaultValue=RemoteConfigParameterValue(value="default_value"),
valueType=ParameterValueType.STRING,
description="A new parameter"
)
config.template.parameters["new_parameter"] = new_param
# find parameter in the template
param = config.find_param_by_key("new_parameter")
param.description = "My new parameter"
2. Working with Conditional Values
from firebase_remote_config import RemoteConfigCondition, TagColor
# Create condition object
condition = RemoteConfigCondition(
name="ios_users",
expression="device.os == 'ios'",
tagColor=TagColor.BLUE,
)
# Insert condition to rconfig template
config.insert_condition(condition)
# Use newly created condition in a conditional value
config.set_conditional_value(
param_key="my_parameter",
param_value=RemoteConfigParameterValue(value="my_value"),
param_value_type=ParameterValueType.STRING,
condition_name="ios_users",
)
3. Building Complex Conditions with ConditionBuilder
from datetime import datetime
from firebase_remote_config.conditions import ConditionBuilder
from firebase_remote_config import RemoteConfigCondition, TagColor
# Create a complex condition
builder = ConditionBuilder()
builder.APP_VERSION().GTE("2.0.0")
builder.CONDITION().APP_USER_PROPERTY("total_purchases_usd").LTE(5)
builder.CONDITION().DEVICE_COUNTRY().IN(["US", "CA", "GB"])
cond_expr = builder.build()
# Serialize condition as string
cond_expr_str = str(cond_expr)
# Insert condition to remote config template
config.insert_condition(RemoteConfigCondition(
name="active_premium_users",
expression=cond_expr_str,
tagColor=TagColor.GREEN,
))
# Set conditional values
feature_param.set_conditional_value(
param_value=RemoteConfigParameterValue(value="true"),
param_value_type=ParameterValueType.BOOLEAN,
condition_name="holiday_promotion",
)
4. Version Management
from firebase_remote_config.models import ListVersionsParameters
# List recent versions
versions, _ = client.list_versions(page_size=30)
# Rollback to a previous version
from firebase_remote_config.models import RollbackRequest
rolled_back_config = client.rollback("42")
License
This project is licensed under the terms of the LICENSE file in the root of this repository.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file firebase_remote_config-0.1.5.tar.gz.
File metadata
- Download URL: firebase_remote_config-0.1.5.tar.gz
- Upload date:
- Size: 21.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7980e294a3e1a524f21d4c0ce8992fc5e67c6d74c2fac143b293347a3cc140d
|
|
| MD5 |
815e7d4207a846e66ec6627ffa798fd6
|
|
| BLAKE2b-256 |
33b1d8026bae6309ca0faf8842d1277f56d8d4b4bbb37730934f96f9a9457c3c
|
Provenance
The following attestation bundles were made for firebase_remote_config-0.1.5.tar.gz:
Publisher:
publish.yml on apprevenew-com/firebase-remote-config-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
firebase_remote_config-0.1.5.tar.gz -
Subject digest:
c7980e294a3e1a524f21d4c0ce8992fc5e67c6d74c2fac143b293347a3cc140d - Sigstore transparency entry: 193988068
- Sigstore integration time:
-
Permalink:
apprevenew-com/firebase-remote-config-python@56e2adb9e81255edc8abbb5bead7be01f7a5b28f -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/apprevenew-com
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@56e2adb9e81255edc8abbb5bead7be01f7a5b28f -
Trigger Event:
push
-
Statement type:
File details
Details for the file firebase_remote_config-0.1.5-py3-none-any.whl.
File metadata
- Download URL: firebase_remote_config-0.1.5-py3-none-any.whl
- Upload date:
- Size: 22.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2966b51c749a8b48f979b1c5c7b2d175afff8516b5b617e3738d18c967ff5f3c
|
|
| MD5 |
2dfc8bd4adee13fe801bab620ee3bd4c
|
|
| BLAKE2b-256 |
fab47ae6cceec24cceec29036cac8f3fed6fb341c5e2c75fb152d92419f2646d
|
Provenance
The following attestation bundles were made for firebase_remote_config-0.1.5-py3-none-any.whl:
Publisher:
publish.yml on apprevenew-com/firebase-remote-config-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
firebase_remote_config-0.1.5-py3-none-any.whl -
Subject digest:
2966b51c749a8b48f979b1c5c7b2d175afff8516b5b617e3738d18c967ff5f3c - Sigstore transparency entry: 193988081
- Sigstore integration time:
-
Permalink:
apprevenew-com/firebase-remote-config-python@56e2adb9e81255edc8abbb5bead7be01f7a5b28f -
Branch / Tag:
refs/tags/v0.1.5 - Owner: https://github.com/apprevenew-com
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@56e2adb9e81255edc8abbb5bead7be01f7a5b28f -
Trigger Event:
push
-
Statement type: