当前位置: 首页>>代码示例>>Python>>正文


Python pyrebase.initialize_app方法代码示例

本文整理汇总了Python中pyrebase.initialize_app方法的典型用法代码示例。如果您正苦于以下问题:Python pyrebase.initialize_app方法的具体用法?Python pyrebase.initialize_app怎么用?Python pyrebase.initialize_app使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyrebase的用法示例。


在下文中一共展示了pyrebase.initialize_app方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup_firebase

# 需要导入模块: import pyrebase [as 别名]
# 或者: from pyrebase import initialize_app [as 别名]
def setup_firebase():
    """
    Instancia objeto de acesso do BD Firebase.

    :return: o objeto do BD Firebase instanciado.
    """
    config = {
        "apiKey": os.environ.get('FIREBASE_API_KEY'),
        "authDomain": os.environ.get('FIREBASE_PROJECT_ID') + ".firebaseapp.com",
        "databaseURL": os.environ.get('FIREBASE_DB_URL'),
        "storageBucket": os.environ.get('FIREBASE_PROJECT_ID') + ".appspot.com",
        "serviceAccount": "./bandex_services_account.json"
    }

    try:
        service_account = os.environ.get('FIREBASE_SERVICE_ACCOUNT')
        f = open('./bandex_services_account.json', 'w')
        f.write(service_account)
        f.close()

    except Exception as e:
        print("Erro ao escrever no arquivo de service account: ", e)
    else:
        print("Service account configurado com sucesso.")

    firebase = pyrebase.initialize_app(config)

    db = firebase.database()
    return db 
开发者ID:gustavoavena,项目名称:CardapioParser,代码行数:31,代码来源:firebase.py

示例2: __init__

# 需要导入模块: import pyrebase [as 别名]
# 或者: from pyrebase import initialize_app [as 别名]
def __init__(self):
		super(PyrebaseCommunicator, self).__init__()
		self.JSONmatches = []
		self.JSONteams = []
		self.url = 'scouting-2017-5f51c'
		config = {
			'apiKey': 'mykey',
			'authDomain': self.url + '.firebaseapp.com',
			'databaseURL': 'https://' + self.url + '.firebaseio.com/',
			'storageBucket': self.url + '.appspot.com'
		}
		app = pyrebase.initialize_app(config)
		self.firebase = app.database()
		self.fbStorage = app.storage()

	#Turns inputted team (class) object into dict and puts on firebase 
开发者ID:frc1678,项目名称:server-2017,代码行数:18,代码来源:firebaseCommunicator.py

示例3: __init__

# 需要导入模块: import pyrebase [as 别名]
# 或者: from pyrebase import initialize_app [as 别名]
def __init__(self):
        ''' Initialize auth, db, storage handles. '''
        self.config = firebase_config
        self.firebase = pyrebase.initialize_app(self.config)
        self.auth = self.firebase.auth()
        self.database = self.firebase.database()
        self.storage = self.firebase.storage()
        self.user = None 
开发者ID:srishanbhattarai,项目名称:Harbor-CLI,代码行数:10,代码来源:firebase_service.py

示例4: __init__

# 需要导入模块: import pyrebase [as 别名]
# 或者: from pyrebase import initialize_app [as 别名]
def __init__(self):
        if config['firebase']['apiKey']:
            self.fb = pyrebase.initialize_app(config['firebase'])
            self.auth = self.fb.auth()
            self.user = self.auth.sign_in_with_email_and_password(config['firebase']['userId'], config['firebase']['userPassword'])
            self.db = self.fb.database()
        return None 
开发者ID:samatt,项目名称:scraper-boilerplate,代码行数:9,代码来源:Firebase.py

示例5: test_add_values

# 需要导入模块: import pyrebase [as 别名]
# 或者: from pyrebase import initialize_app [as 别名]
def test_add_values():
    firebase = pyrebase.initialize_app(FIREBASE_CONFIG)
    pprint(FIREBASE_CONFIG)

    db = firebase.database()
    db_store1 = db.child("store1")

    # Add data (with default timestamped key) 
    timestamped_data = {"key1": "data1"}
    db_store1.push(timestamped_data)

    # Add data with custom key
    key_value_data = {"key2": {"key2_1": "data2"}}
    db_store1.push(key_value_data) 
开发者ID:mozilla-mobile,项目名称:prox-server,代码行数:16,代码来源:firebase-test.py

示例6: get_firebase

# 需要导入模块: import pyrebase [as 别名]
# 或者: from pyrebase import initialize_app [as 别名]
def get_firebase():
    firebase_credentials = get_credentials()
    config = {
        "apiKey": firebase_credentials[0],
        "authDomain": firebase_credentials[1],
        "databaseURL": firebase_credentials[2],
        "storageBucket": firebase_credentials[3]
    }
    firebase = pyrebase.initialize_app(config)

    return firebase 
开发者ID:Bullrich,项目名称:Diario-Opositor-Bot,代码行数:13,代码来源:firebase_login.py

示例7: __init__

# 需要导入模块: import pyrebase [as 别名]
# 或者: from pyrebase import initialize_app [as 别名]
def __init__(self, firebase_config):
        self.firebase = pyrebase.initialize_app(firebase_config)
        self.auth = self.firebase.auth()
        self.storage = self.firebase.storage()
        self.user = None
        self.user_info = None 
开发者ID:gaborvecsei,项目名称:Home-Security,代码行数:8,代码来源:firebase.py

示例8: init

# 需要导入模块: import pyrebase [as 别名]
# 或者: from pyrebase import initialize_app [as 别名]
def init():
    config = {
        "apiKey": "AIzaSyAGTGrZCbaSYvCyTK3lSdJVDWCqRXwvEvo",
        "authDomain": "gauge-97536.firebaseapp.com",
        "databaseURL": "https://gauge-97536.firebaseio.com",
        "storageBucket": "gauge-97536.appspot.com",
        "serviceAccount": "firebase/fb.json"
    }

    global db
    db = pyrebase.initialize_app(config).database() 
开发者ID:kashishm,项目名称:gauge,代码行数:13,代码来源:fb.py


注:本文中的pyrebase.initialize_app方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。