class FirebasePlugin(IPlugin): def __init__(self): try: with open(secrets_filename, "r") as f: data = f.read() except: err = "Error processing {} - make sure to fill in {}!".format(secrets_filename, secrets_filename) with open(secrets_filename, "w") as f: f.write(document) raise Exception(err) try: conf = yaml.load(data) self.firebase_url = conf["firebase_url"] self.secret = conf["secret"] self.data_bucket = conf["data_bucket"] except: raise Exception("Error parsing {}!".format(secrets_filename)) if self.firebase_url is None or self.secret is None: raise Exception("Error parsing {} - not all fields have been filled in!".format(secrets_filename)) auth_payload = {"uid": "1", "auth_data": "foo", "other_auth_data": "bar"} token = create_token(self.secret, auth_payload) self._client = Firebase(self.firebase_url + self.data_bucket, auth_token=token) def process_message(self): message = messages[random.randint(0, len(messages)-1)] self._client.push({'timestamp': int(time.time()), 'message': message})
def upload(status): f = Firebase('https://amber-fire-5569.firebaseio.com/tweets') payload = {} payload['body'] = status['text'] payload['geo'] = status['geo'] payload['date'] = status['created_at'] print payload f.push(payload)
def order(): name = request.args.get('first name') food = request.args.get('my_meal') firebase_food = Firebase( 'https://bott-a9c49.firebaseio.com/lukkiddd/hbot/foods') firebase_food.push({"name": name, "food": food}) messages = {"messages": [{"text": u"เรียบร้อย"}]} return jsonify(messages)
def send_data(msg, path): from firebase import Firebase try: fbase = Firebase(path) fbase.push(msg) except Exception as e: print("FireBase: can not send the data to the server:" + str(e)) print("FireBase: not uploading") return "exception"
class StreamListener(tweepy.StreamListener): def setup(self, filter_by): # Initialize Firebase object with our tweet filter self.firebase = Firebase( filter_by ) # TODO: Do we need to make a new firebase object for each streamlistener... probs not lul def get_sentiment(self, text): # Returns a sentiment value [-1, 1] for the text # TODO: Need to create an sentiment analyzer that understands LoL lingo processed_text = TextBlob(text) return processed_text.sentiment.polarity def on_status(self, status): # Callback function for streamed tweets # Update firebase with this tweets information # - If new tweet: Upload the tweet's text, id_str, hashtags, original url, and any counts # - Else: Update the tweet's information: retweet count, favorite count, reply count (can also play around with the replies) # Twitter object info: https://developer.twitter.com/en/docs/tweets/data-dictionary/overview/tweet-object print("\nSTART\n") if "RT" in status.text: # This is a retweet so it may be shortened. # Use the retweeted_status object to get the full tweet. tweet_text = status.retweeted_status.text polarity = self.get_sentiment(tweet_text) self.firebase.push({ "tweet_id": status.retweeted_status.id_str, "polarity": polarity }) print("Original tweet:", status.retweeted_status.text) print("Polarity: ") else: tweet_text = status.text polarity = self.get_sentiment(tweet_text) self.firebase.push({ "tweet_id": status.id_str, "polarity": polarity }) print("Tweet-text:", status.text) print("Retweeted:", status.retweeted) print("Entities:", status.entities) print("\nEND\n") # print("Retweet-count:", status.retweet_count) # print("Reply-count:", status.reply_count) # print("Favorite-count:", status.favorite_count) def on_error(self, status_code): if status_code == 420: return False
def post(self): logging.info(self.request.body) slack_data = dict(x.split('=') for x in self.request.body.split('&')) txdata = slack_data['text'].replace("+", " ") rdata = txdata.split('%3A') session_id = rdata[0] msg = rdata[1] logging.info(slack_data) f = Firebase('https://chat-interface1.Firebaseio.com/chat-interface1') # r = f.push({'session_id': session_id, 'message': msg}) # c = f.child(session_id) f.push({'session_id': session_id, 'message': msg})
class FirebaseInteraction: def __init__(self): self.tweet_firebase = Firebase('https://vmx.firebaseio.com/tweets') self.report_firebase = Firebase('https://vmx.firebaseio.com/reports') def post_new_tweet(self, tweet_id, title, tweet, location_title, lat, lon, username): if location_title != '': response = self.tweet_firebase.push({ 'username': username, 'tweet_id': tweet_id, 'title': title, 'text': tweet, 'location': { 'title': location_title, 'lat': lat, 'lon': lon } }) else: response = self.tweet_firebase.push({ 'username': username, 'tweet_id': tweet_id, 'title': title, 'text': tweet }) print response def post_new_report(self, tweet_id, title, tweet, location_title, lat, lon, username): if location_title != '': response = self.report_firebase.push({ 'username': username, 'tweet_id': tweet_id, 'title': title, 'text': tweet, 'location': { 'title': location_title, 'lat': lat, 'lon': lon } }) else: response = self.report_firebase.push({ 'username': username, 'tweet_id': tweet_id, 'title': title, 'text': tweet }) print response
def get_ladder(self): """Parses footywire HTML to get ladder""" ladder_url = "ft_ladder" session = requests.session() response = session.get(self.baseURL + ladder_url, headers=self.headers) soup = BeautifulSoup(response.text) ladder = [] for link in soup.find_all('a'): mylink = link.get('href') if mylink.find('/') == -1: if mylink.find('ft') == -1: mylink = mylink[3:] mylink = mylink.replace('-', ' ') ladder.append((mylink)) if ladder: f = Firebase('https://flickering-fire-9394.firebaseio.com/ladder') response = f.remove() print response for team in ladder: team = multipleReplace(team) print team r = f.push({'team_id': team })
def store_data(): #db=sqlite3.connect('database.db'); #curs = db.cursor() #curs.execute('CREATE TABLE Shelter(user TEXT, email TEXT, phone TEXT, comment TEXT, duration TEXT );') f = Firebase('https://shelterx2.firebaseio.com/data') t_usr=request.form['usr'] t_email=request.form['email'] t_phone=request.form['phone'] t_description=request.form['description'] t_duration=request.form['duration'] t_country=request.form['country'] t_city=request.form['city'] f.push({'name':t_usr,'email':t_email,'phone':t_phone,'description':t_description,'duration':t_duration, 'country':t_country, 'city':t_city}) #curs.execute('INSERT INTO Shelter (user,email,phone,comment,duration) VALUES (?,?,?,?,?);',(t_usr,t_email,t_phone,t_comment,t_duration)) #db.commit() #db.close() return redirect('/')
def register(): f_name = request.args.get('first name') l_name = request.args.get('last name') gender = request.args.get('gender') local = request.args.get('local') profile_pic = request.args.get('profile pic url') messenger_user_id = request.args.get('messenger user id') users = Firebase('https://bott-a9c49.firebaseio.com/lukkiddd/users/') users.push({ 'first_name': f_name, 'last_name': l_name, 'gender': gender, 'local': local, 'profile_pic': profile_pic, 'messenger_user_id': messenger_user_id }) message = [{'text': u'ยินดีต้อนรับนะคะ'}] return jsonify(message)
def seller_add_item(): f_name = request.args.get('first name') item_name = request.args.get('item_name') item_image = request.args.get('item_image') item_price = request.args.get('item_price') messenger_user_id = request.args.get('messenger user id') new_item = { 'owner': f_name, 'owner_messenger_id': messenger_user_id, 'item_name': item_name, 'item_image': item_image, 'item_price': item_price, 'created_at': str(datetime.datetime.now()) } item = Firebase('https://bott-a9c49.firebaseio.com/lukkiddd/items/') item.push(new_item) message = [{'text': u'เรียบร้อยแล้ว! เดี๋ยวถ้ามีคนสนใจ จะทักไปบอกนะคะ :D'}] return jsonify(message)
class FirebaseInteraction: def __init__(self): self.tweet_firebase = Firebase('https://vmx.firebaseio.com/tweets') self.report_firebase = Firebase('https://vmx.firebaseio.com/reports') def post_new_tweet(self, tweet_id, title, tweet, location_title, lat, lon, username): if location_title != '': response = self.tweet_firebase.push({'username': username, 'tweet_id': tweet_id, 'title': title, 'text': tweet, 'location': {'title': location_title, 'lat': lat, 'lon': lon}}) else: response = self.tweet_firebase.push({'username': username, 'tweet_id': tweet_id, 'title': title, 'text': tweet}) print response def post_new_report(self, tweet_id, title, tweet, location_title, lat, lon, username): if location_title != '': response = self.report_firebase.push({'username': username, 'tweet_id': tweet_id, 'title': title, 'text': tweet, 'location': {'title': location_title, 'lat': lat, 'lon': lon}}) else: response = self.report_firebase.push({'username': username, 'tweet_id': tweet_id, 'title': title, 'text': tweet}) print response
def add_activity(d): """Add an activity to the stream. """ info = get_auth_info(None, None, admin=True) url = '%s/activities/' % (info['config']['firebase_url'], ) activities = Firebase(url, auth_token=info['auth_token']) response = activities.push(d) if not isinstance(response, dict): # Not on python2.6. response = response() print "Actitity added, FB Response", response
class TestFirebase(unittest.TestCase): @classmethod def setUpClass(self): self.fire = Firebase() self.patchFirestore = patch('firebase_admin.firestore', autospec=True) self.patchCredentials = patch('firebase_admin.credentials', autospec=True) self.mockFirestore = self.patchFirestore.start() self.mockCredentials = self.patchCredentials.start() self.store = self.mockFirestore self.credential = self.mockCredentials self.fire.cred = self.credential self.fire.db = self.store.client() self.commentDictionary = dict() self.commentDictionary['e0j9iet'] = datetime(2018, 6, 27, 18, 0, tzinfo=timezone.utc) def test_push(self): for k, v in self.commentDictionary.items(): self.fire.push('test_comments', k, v) def test_pull(self): response = dict() for data in self.fire.pull('test_comments'): response = data.to_dict() @classmethod def tearDownClass(self): self.patchFirestore.stop() self.patchCredentials.stop()
def authenticate(): fb = Firebase('https://hack-in.firebaseio.com/users') form = FormLogin() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() if user is not None and user.verify_pass(form.password.data): login_user(user, form.remember_me.data) rfb = fb.push({'user_id': user.username, 'email': user.email}) return redirect(request.args.get('next') or url_for('main.home')) flash('Invalid username or password.') return render_template('authentication/login.html', form=form, session=session)
def consider_suggestions(self): body = self.bodyData.split(" ") next_song = Firebase(FIREBASE_URL + 'next_song/') if len(body) == 2 and body[0].lower() == 'vocal': print "NEW VOCALS YEAH" next_song.update({'must_play':1, 'song_name': body[1].lower(), 'song_type': 'vocal'}) return elif len(body) == 2 and body[0].lower() == 'instrumental': next_song.update({'must_play':1, 'song_name': body[1].lower(), 'song_type': 'instrumental'}) return res = Firebase("https://blazing-fire-4446.firebaseio.com/songs/" + self.bodyData + "/").get() #print res if not res: curFB = Firebase("https://blazing-fire-4446.firebaseio.com/songs/") curFB.push({'RNG':1, 'file_name':"testFN", 'file_type':"instrumental", 'id':self.bodyData, 'song_name':"testFN", 'start_time':30}) else: curRNG = Firebase("https://blazing-fire-4446.firebaseio.com/songs/" + self.bodyData + "/RNG/").get() print curRNG curRNG = curRNG + 1 print curRNG rngREF = Firebase("https://blazing-fire-4446.firebaseio.com/songs/" + self.bodyData + "/") rngREF.update({"RNG": curRNG})
#!/usr/bin/env python # -*- coding: utf-8 -*- import json import codecs import yaml from firebase import Firebase import re f = Firebase('https://omagma-abe44.firebaseio.com/gearmotors') with codecs.open('a.json', "r", encoding='utf-8', errors='ignore') as data_file: data = json.load(data_file) dump_data = json.dumps(data) y_data = yaml.safe_load(dump_data) a = y_data[0] for y in y_data: firebase_data = {} for a in y: b = a if "Rated Current".lower() in a.lower(): b = 'rated current' key = re.sub(r'[\W.\/()]+', '', b).lower() firebase_data[key] = {'name': b, 'value': y[a]} print firebase_data print '\n\n=====\n\n' r = f.push(firebase_data)
from firebase import Firebase import random import datetime f = Firebase('https://atlast.firebaseio.com/userstest') for u in range(10): d = datetime.timedelta(minutes=random.randint(1,400)) s = datetime.datetime.now() + d tr = [0,0,0,0,0,0,0,0] for i in range(8): tr[i]= random.randint(1,30) user ={ "start": s.isoformat(), "user": "******"+str(u), "timeroute":tr} print f.push(user)
import time import RPi.GPIO as io from firebase import Firebase svy_coordinates_smu = (29807.414688111774, 31137.837192226452) lat_lng_coordinates_smu = (1.297874, 103.849559) f = Firebase('https://rum.firebaseio.com/events') io.setmode(io.BCM) pir_pin = 18 io.setup(pir_pin, io.IN) while True: if io.input(pir_pin): print("1") timestamp = time.time() dict_firebase = {'easting': svy_coordinates_smu[0], 'northing': svy_coordinates_smu[1], 'lat': lat_lng_coordinates_smu[0], 'lng': lat_lng_coordinates_smu[1], 'time': timestamp, ".priority": timestamp, 'type': 'motion'} r = f.push(dict_firebase) print dict_firebase print r else: print("0") time.sleep(0.5)
from pprint import pprint from firebase import Firebase import requests f = Firebase('https://burning-fire-8681.firebaseio.com/see-again-choices-R1/Alex') r = f.push( { "user_num": 24, "n": 9, "mn": 5, "my": 7, "y": 12 } ) # ff = Firebase('https://burning-fire-8681.firebaseio.com/see-again-choices-R1/{}'.format(r["name"])) s = f.get() print r # {u'name': u'-Jnbjgqt4tThZmXkyhcS'} # print s # {u'name': u'-Jnbjh7LWmhSyoIGbgyZ'} pprint(s) pprint(s[r["name"]]) # These are the names of the snapshots -- # dictionaries containing Firebase's REST response. print "\n\n\n\n"
from firebase import Firebase f = Firebase('https://radiant-fire-7063.firebaseio.com/test') r = f.push({ 'date': '2015-11-09', 'WTI': 43.870, 'Dubai': 44.370, 'Brent': 47.830, 'type': 1 }) ##{'date':'2015-11-09','WTI':'43.870','Dubai':'44.370','Brent':'47.830','type':'1'}
def get_results_ext(self): """Parses footywire HTML to get ladder""" result_url = "ft_match_list?year=2015" session = requests.session() response = session.get(self.baseURL + result_url, headers=self.headers) soup = BeautifulSoup(response.text, 'html.parser') scores = soup.find_all(href=re.compile('ft_match_statistics')) final_match_list = [] for score in scores: match_score = score.string final_match_list.append(match_score) #list_to_file(final_match_list, 'scores') allrows = soup.findAll('tr') userrows = [t for t in allrows if t.findAll(text=re.compile('v '))] rowlist = [] count = 0 for row in userrows: rowtxt = row.findAll(href=re.compile('th-')) rowlist.append(rowtxt) for row in userrows: rowtxt = row.findAll(href=re.compile('ft_match_statistics')) #print rowtxt if rowtxt == []: pass #count += 1 #print "Round" + str(count) else: scraper.score_string(str(rowtxt), '>', '<') #rowlist.append(rowtxt) firebasedb = Firebase('https://flickering-fire-9394.firebaseio.com/results/') response = firebasedb.remove() length = len(rowlist) - 3 newlist = rowlist[-length:] count = 1 idx = 0 for row in newlist: if count < 25: if row == []: current_round = "round" + str(count) count += 1 print current_round else: thteam = doit(str(row[0])) thteam_two = doit(str(row[1])) #thteam = clean_team(thteam) #thteam_two = clean_team(thteam_two) match_score_one, match_score_two = scraper.format_match_score(final_match_list[idx]) idx += 1 result = parse_result(clean_team(thteam), match_score_one, clean_team(thteam_two), match_score_two) fireb = Firebase('https://flickering-fire-9394.firebaseio.com/results/'+ current_round) resp = fireb.push({'match': result }) #print result """
# coding=UTF-8 import datetime import requests from firebase import Firebase f = Firebase('https://oildata2.firebaseio.com/datas') res = requests.get("http://new.cpc.com.tw/division/mb/oil-more1-1.aspx") source = res.text tmp1 = source.split('<td width="9%">') nineeight = tmp1[2].split('</td>') ninefive = tmp1[4].split('</td>') ninetwo = tmp1[6].split('</td>') ultra = tmp1[10].split('</td>') ninetwoP = ninetwo[0] ninefiveP = ninefive[0] nineeightP = nineeight[0] ultraP = ultra[0] tmp2 = source.split('<span>') d1 = tmp2[5] d2 = tmp2[6] d3 = tmp2[7] year = d1.split('</span>') month = d2.split('</span>') day = d3.split('</span>') newdate = datetime.datetime(int(year[0]), int(month[0]), int(day[0])) date = newdate.strftime("%Y-%m-%d") r = f.push({'date':date,'ninetwo':float(ninetwoP),'ninefive':float(ninefiveP),'nineeight':float(nineeightP),'ultra':float(ultraP),'type':0})
def getDates(date_range): dates = re.findall('\d+/\d+ - \d+/\d+', date_range) dates = dates[0].split(' - ') new_dates = [] for date in dates: if date[:2] in ('10', '11', '12'): date += '/2011' else: date += '/2012' new_dates.append(datetime.datetime.strptime(date, '%m/%d/%Y')) dates = generate_dates(new_dates[0], new_dates[1]) new_dates = [] for date in dates: new_dates.append(date.strftime('%s')) return new_dates with open(data_file, 'rb') as polls_csv: polls_reader = csv.reader(polls_csv, delimiter=',') for row in polls_reader: row_dict = {} for counter, item in enumerate(row): row_dict[schema[counter]] = item dates = getDates(row_dict['Date']) for date in dates: row_dict['Date'] = date #print row_dict print 'about to push!' f.push(row_dict) print 'done!'
__author__ = "EliFinkelshteyn" from firebase import Firebase import simplejson as json f = Firebase("http://demo.firebase.com/seifeet/poll_data") for item in json.load(open("../Data/obama.json")): if isinstance(item, dict): print "about to push!" f.push(item) print "done!"
from firebase import Firebase import urllib3 as urllib from urllib.parse import urlparse import pickle with open('google_results', 'rb') as f: googlers = pickle.load(f) with open('urls', 'rb') as f: urls = pickle.load(f) f = Firebase('https://firebase.q-dev-challenge-hannah.firebaseapp.com', auth_token='xxx') for g in range(len(googlers)): for label in googlers[g]: f.push({ 'label': label['description'], 'score': label['score'], 'url': urls[g] })
def post(self): #getting currentUrl from front end # if 'url' in self.request.body: # global currentUrl # currentUrl = json.loads(self.request.body)['url'] # logging.info(currentUrl) # q = [p.to_dict() for p in model.ChatClients().query(model.ChatClients.website_url == currentUrl).fetch()] # logging.info(q) # botToken = q[0]['bot_token'] # logging.info(botToken) #getting data from slack slack_data = dict(x.split('=') for x in self.request.body.split('&')) logging.info(slack_data) txdata = slack_data['text'].replace("+", " ") # txdata = urllib.unquote(slack_data['text']).decode() logging.info(txdata) #sending data from slack to api.ai for faq or result text to firebase if "faq" in txdata: fdata = txdata.split("%3A") logging.info(fdata) fdataq = fdata[0].split("faq") logging.info(fdataq) faq = fdataq[1] faqans = fdata[1] logging.info(faq) logging.info(faqans) obfaq = { "name": faq, "auto": "true", "contexts": [], "templates": [], "userSays": [{ "data": [ { "text": faq }, ], "isTemplate": "false", "count": 0 }], "responses": [{ "resetContexts": "false", "affectedContexts": [], "parameters": [], "speech": faqans }], "priority": 500000 } req = urllib2.Request('https://api.api.ai/v1/intents?v=20150910') req.add_header("Authorization", "Bearer" + botToken) logging.info(botToken) req.add_header("charset", "utf-8") req.add_header("Content-Type", "application/json") response = urllib2.urlopen(req, json.dumps(obfaq)) logging.info(response) else: rdata = txdata.split('%3A') logging.info(rdata) prevSession = rdata[1].replace("%40", "@").split("%7C") session_id = prevSession[0] msg = rdata[2] logging.info(slack_data) logging.info(session_id) logging.info(msg) f = Firebase( 'https://chat-interface1.Firebaseio.com/chat-interface1', None) f.push({'session_id': session_id, 'message': msg})
__author__ = 'EliFinkelshteyn' from firebase import Firebase import simplejson as json import datetime #"Fri, 21 Sep 2012 16:53:08 +0000" def getTwitterDate(date): date = date[:-6] date = datetime.datetime.strptime(date, '%a, %d %b %Y %H:%M:%S') date += datetime.timedelta( 0, -7*60*60) return date.strftime('%s') f = Firebase('http://demo.firebase.com/seifeet/twitter_data') for item in json.load(open('../Data/romney.json')): if isinstance(item,dict): item['date'] = getTwitterDate(item['created_at']) print 'about to push!' f.push(item) print 'done!'
# Usage: make sure parsed.shelve exists at correct path, then simply run the script # parsed.data is generated by Sentiment/parse_result.py, # which uses data collected from twitter cralwer and sentiment result __author__ = 'bill.yang' import shelve from firebase import Firebase parsed_db = shelve.open('parsed.data') parsed_data = parsed_db['data'] f = Firebase('http://demo.firebase.com/seifeet/twitter_data_2') for key, value in parsed_data.items(): f.push(value)
def updateQuestion(question): base_url='https://<DATABASEURL>.firebaseio.com/' tag= Firebase(base_url+'unanswered') tag.push(question)
def getDates(date_range): dates = re.findall('\d+/\d+ - \d+/\d+',date_range) dates = dates[0].split(' - ') new_dates = [] for date in dates: if date[:2] in ('10','11','12'): date += '/2011' else: date +='/2012' new_dates.append(datetime.datetime.strptime(date, '%m/%d/%Y')) dates = generate_dates(new_dates[0], new_dates[1]) new_dates = [] for date in dates: new_dates.append(date.strftime('%s')) return new_dates with open(data_file, 'rb') as polls_csv: polls_reader = csv.reader(polls_csv, delimiter=',') for row in polls_reader: row_dict = {} for counter, item in enumerate(row): row_dict[schema[counter]] = item dates = getDates(row_dict['Date']) for date in dates: row_dict['Date'] = date #print row_dict print 'about to push!' f.push(row_dict) print 'done!'
from firebase import Firebase f = Firebase('https://tfgsrkapi.firebaseio.com/data') r = f.push({'user_id': 'wilma', 'text': 'Hello'}) print r
# coding=UTF-8 import datetime import requests from firebase import Firebase f = Firebase('https://oildata2.firebaseio.com/datas/predict') res = requests.get("http://www.taiwanoil.org/") source = res.text tmp1 = source.split("</td></tr>") nextweek_price = [] for col in tmp1 : if "<td style='text-align:right;'>" in col : tmp2 = col.split("<td style='text-align:right;'>",-1)[-1] nextweek_price[len(nextweek_price):] = [tmp2] nextweek_98 = nextweek_price[1] nextweek_95 = nextweek_price[2] nextweek_92 = nextweek_price[3] nextweek_ultra = nextweek_price[4] #print "--- next week ---" print "98 : " + nextweek_98 print "95 : " + nextweek_95 print "92 : " + nextweek_92 print "ultra : " + nextweek_ultra ##r = f.push({'ninetwo':float(nextweek_92),'ninefive':float(nextweek_95),'nineeight':float(nextweek_98),'ultra':float(nextweek_ultra)}) r = f.delete(); r = f.push({'ninetwo':float(nextweek_92),'ninefive':float(nextweek_95),'nineeight':float(nextweek_98),'ultra':float(nextweek_ultra)})
} res = requests.post( "http://web3.moeaboe.gov.tw/oil102/oil1022010/A02/A0201/daytable.asp", data=query) source = res.text #print source tmp1 = source.split('<td bgcolor="#66CCFF" align="center"><br>', 1) tmp2 = tmp1[1].split('</tr>') tmp3 = tmp2[0].split('G') WTI = tmp3[1].split('<p>')[0] Dubai = tmp3[2].split('<p>')[0] Brent = tmp3[3].split()[0] date = d1.strftime("%Y-%m-%d") #file.write('ref.push({\n') #file.write('\tdate:"'+date+'",\n') #file.write('\tWTI: '+ WTI+',\n') #file.write('\tDubai: '+ Dubai+',\n') #file.write('\tBrent: '+ Brent+',\n') #file.write('\ttype: 1\n});\n') r = f.push({ 'date': date, 'WTI': float(WTI), 'Dubai': float(Dubai), 'Brent': float(Brent), 'type': 1 }) d1 = d1 + datetime.timedelta(days=1) file.close()
from firebase import Firebase f = Firebase('https://satyam-tarp.firebaseio.com/') f = Firebase('https://satyam-tarp.firebaseio.com/message_list') r = f.push({'user_id': 'wilma', 'text': 'Hello'}) Name = raw_input("enter your name") Text = raw_input('enter you message') r = f.push({'user_id': Name, 'text': Text})