我一直在努力在我的第二台 PC 上安装 pyrebase,它与我的主 PC 具有相同的 python 版本 3.8.2,我的主 PC 有这个 pyrebase 脚本正常工作
from pyrebase import pyrebase
import os
import time
project_root = os.path.dirname(os.path.dirname(__file__))
keys_path = os.path.join(project_root, 'keys')
hylKeyPath = os.path.join(keys_path, 'ServiceAccountKey.json')
firebase = pyrebase.initialize_app({
"apiKey": "aksdjalksjdlkajsdlkjalkdja",
"authDomain": "lkjsakdjlkjsad.firebaseapp.com",
"databaseURL": "https://asdlkasjldkjaslkd.firebaseio.com",
"storageBucket": "asdasdadjaslkjhd.appspot.com",
"serviceAccount": asdKeyPath
})
storage = firebase.storage()
def sleepCountDown(t):
while t > 0:
print(f"sleeping for {t} seconds...")
t -= 1
time.sleep(1)
while True:
print('fetching data')
files = storage.child('/').list_files()
for file in files:
if 'records/' in file.name:
# get the file url path
# print(storage.child(file.name).get_url(None))
# downloads file
storage.child(file.name).download(os.path.basename(file.name))
# deletes file? kinda deletes the entire folder
storage.delete(file.name)
sleepCountDown(10)
但不知何故,我无法在我的第二台 PC 上安装 pyrebase,所以我不得不安装 pyrebase4。
但似乎这个有一些错误,并一直强调storage.child(file.name).download(os.path.basename(file.name))
说 storage: No value for argument 'filename' in method call。
然后当我运行时,它说“加密没有方法或其他东西”
有谁知道发生了什么?