我想制作一个python脚本作为firebase应用程序的后端。在
我想在特定的时间,在firebase中发布一个对象。但它被出版了3、4或5次。。例如,我只需要jobstorealum()的一条记录。在
谢谢你的帮助
from time import sleep
import time
import datetime
from firebase import firebase
import urllib2, urllib, httplib
import json
import os
from functools import partial
firebase = firebase.FirebaseApplication('https://plante-.firebaseio.com/', None)
import schedule
def jobAllum():
x=1
y=True
firebase.put("/Interuptors/Elec01", "/value", x)
firebase.put("/Interuptors/Elec01", "/state", y)
def jobStoreAllum():
dateString = '%d/%m/%Y %H:%M:%S'
y=True
data = {"State": y,"Horodate":datetime.datetime.now().strftime(dateString) }
firebase.post('/Storage/Journee', data)
while True:
Hallum= firebase.get("/Autom/Prog1/Hallum", None)
schedule.every().day.at(Hallum).do(jobAllum)
schedule.every().day.at(Hallum).do(jobStoreAllum)
schedule.run_pending()
time.sleep(10)
您可以使用云调度程序。 确保终止返回值的函数。 注意函数超时,默认值为1分钟,最大值为9分钟。 你将必须为项目启用计费,你每月有3个免费工作,超过3个将收取0.10美元/作业,而不是执行。在
见This
相关问题 更多 >
编程相关推荐