本文整理汇总了Python中firebase.Firebase.post方法的典型用法代码示例。如果您正苦于以下问题:Python Firebase.post方法的具体用法?Python Firebase.post怎么用?Python Firebase.post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类firebase.Firebase
的用法示例。
在下文中一共展示了Firebase.post方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: schedule
# 需要导入模块: from firebase import Firebase [as 别名]
# 或者: from firebase.Firebase import post [as 别名]
def schedule(self, file_path):
track = Firebase(FIREBASE_URL + "tracks/")
track_data = {}
track_data["url"] = file_path.replace(os.path.join(os.getcwd(), "jukebox"), "")
track_data["offset"] = self.play_time(file_path)
track.post(track_data)
示例2: process
# 需要导入模块: from firebase import Firebase [as 别名]
# 或者: from firebase.Firebase import post [as 别名]
def process(file):
f = open(file, 'rU')
reader = csv.DictReader(f, fieldnames=fieldnames)
i = 0
rows = list(reader)
l = len(rows)
for row in rows:
id = row['CAMIS']
inspect_loc = "https://eat-here-or-there.firebaseio.com/nyc/restaurants/{0}/inspections".format(id)
fire_inspection = Firebase(inspect_loc, token)
del row['CAMIS']
try:
fire_inspection.post(row)
except (UnicodeDecodeError, requests.exceptions.ConnectionError) as e:
print row
i += 1
printProgress(i, l, prefix = 'Progress:', suffix = 'Complete', barLength = 50)
示例3:
# 需要导入模块: from firebase import Firebase [as 别名]
# 或者: from firebase.Firebase import post [as 别名]
# # collect the files
# if f.rsplit('.', 1)[1].lower() in ['mp3', 'aif', 'aiff', 'aifc', 'wav']:
# # file_list.append(os.path.join(directory,f))
# data = {}
# data['file_name'] = f
# data['bpm'] = 140
# data['RNG'] = 1
# data['file_type'] = "instrumental"
# data['start_time'] = 30
# data['volume'] = 1.0
# data['song_name'] = f[:-4]
# # Need to add in ID by hand
# song_db.post(data)
ff = os.listdir(VOCAL_DIR)
for f in ff:
# collect the files
if f.rsplit('.', 1)[1].lower() in ['mp3', 'aif', 'aiff', 'aifc', 'wav']:
# file_list.append(os.path.join(directory,f))
data = {}
data['file_name'] = f
data['bpm'] = 140
data['RNG'] = 1
data['file_type'] = "vocal"
data['start_time'] = 30
data['volume'] = 1.0
data['song_name'] = f[:-4]
# Need to add in ID by hand
song_db.post(data)
示例4: Firebase
# 需要导入模块: from firebase import Firebase [as 别名]
# 或者: from firebase.Firebase import post [as 别名]
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 06 11:42:45 2016
@author: Claudio
"""
from firebase import Firebase
f = Firebase('https://wesee-dw.firebaseio.com/teste')
f.post({'text': 'Hello'})
示例5: Firebase
# 需要导入模块: from firebase import Firebase [as 别名]
# 或者: from firebase.Firebase import post [as 别名]
data = []
ff = os.listdir(INSTRUMENTAL_DIR)
for f in ff:
# collect the files
if f.rsplit('.', 1)[1].lower() in ['mp3', 'aif', 'aiff', 'aifc', 'wav']:
# file_list.append(os.path.join(directory,f))
file_path = os.path.join(INSTRUMENTAL_DIR, f)
song = audio.LocalAudioFile(file_path).analysis
song_feats = {}
song_feats['loudness'] = song.loudness
song_feats['tempo'] = song.tempo.get('value')
song_feats['name'] = f.rsplit('.',1)[0]
data.append(song_feats)
similarity_instrumental.post(data)
#################### COPY PASTED ##################
# similarity_vocal = Firebase(FIREBASE_URL + "similarity_vocal/")
# data = []
# ff = os.listdir(VOCAL_DIR)
# for f in ff:
# # collect the files
# if f.rsplit('.', 1)[1].lower() in ['mp3', 'aif', 'aiff', 'aifc', 'wav']:
# # file_list.append(os.path.join(directory,f))
# file_path = os.path.join(VOCAL_DIR, f)
# song = audio.LocalAudioFile(file_path).analysis
# song_feats = {}
# song_feats['loudness'] = song.loudness
# song_feats['tempo'] = song.tempo.get('value')
示例6: create_token
# 需要导入模块: from firebase import Firebase [as 别名]
# 或者: from firebase.Firebase import post [as 别名]
from firebase import Firebase
from firebase_token_generator import create_token
import time
import random
auth_payload = {"uid":"k6wJ1M33MnaTiuRGU5IrFTwM5H53"}
token = create_token("1ufUtMReQxZlUe8kHdCs2WDfcmWdDKNeIziMg49o", auth_payload)
for i in range (1,100):
spotId = random.randrange(1,127)
f = Firebase("https://parking-monitor.firebaseio.com/lots/S17", auth_token=token)
distance = random.randrange(0,400)
randTime = random.randrange(1435255107,1465265107)
rp = f.post({"date":randTime, "serial":"HC-SR04-1", "distance":distance, "spot":spotId})
print("POST: " + str(rp))
time.sleep(1)