如何将音频上传到Firebase存储python,1.wav.wav是我想上传到我的firebase的音频文件
import pyrebase
config = {
"apiKey": "xxxxxxxxxxxxxxxxxx",
"authDomain": "xxxxxxxxxxx",
"projectId": "xxxxxxxxxxx",
"storageBucket": "xxxxxxxxxxxxxx",
"messagingSenderId": "xxxxxxxxxxxxx",
"appId": "xxxxxxxxxxxxxxxxxxxx",
"measurementId": "G-5GCDEC526E"
}
firebase = pyrebase.initialize_app(config)
localpath="1.wav.wav"
cloudpath="audios/audi1.wav"
firebase.storage().child(cloudpath).put(localpath)
我发现数据库URL丢失,请仔细检查您的配置并添加它,如下所示:
import pyrebase
config = {
"apiKey": "xxxxxxxxxxxxxxxxxx",
"authDomain": "xxxxxxxxxxx",
"projectId": "xxxxxxxxxxx",
“databaseURL” : “https://project_name.firebaseio.com",
"storageBucket": "xxxxxxxxxxxxxx",
"messagingSenderId": "xxxxxxxxxxxxx",
"appId": "xxxxxxxxxxxxxxxxxxxx",
"measurementId": "G-5GCDEC526E"
}
#initializing firebase {pyrebase}
firebase = pyrebase.initialize_app(config)
#initializing storage variable
storage = firebase.storage()
#uploading the audio to firebase database
#storage.child(“folder_name/audio_name”).put(“file_to_be_uploaded”)
storage.child(“audios/audi1.wav”).put(“./1.wav.wav”)