Beispiel #1
0
 def DBConnection(self):
     self.firebaseClient = FirebaseApplication(
         'https://eat2fit-adcd2.firebaseio.com', authentication=None)
     authentication = FirebaseAuthentication(
         'JQxgwXKOwoBa5piS5cphXoc0ToiJaq2qDwAkPzPo',
         '*****@*****.**',
         extra={'id': 'kRZ84YKZXPS9ZIIULOVOV8pXUQt2'})
     self.firebaseClient.authentication = authentication
     user = authentication.get_user()
Beispiel #2
0
 def __init__(self):
     self.version = "1.0.0"
     print("""
    ▄▄▄▄▀ ▄  █ ▄███▄         ▄▀  ██   █▀▄▀█ ███   ▄█ ██   █▄▄▄▄ █▄▄▄▄ ██       ▄█ ▄█ 
 ▀▀▀ █   █   █ █▀   ▀      ▄▀    █ █  █ █ █ █  █  ██ █ █  █  ▄▀ █  ▄▀ █ █      ██ ██ 
     █   ██▀▀█ ██▄▄        █ ▀▄  █▄▄█ █ ▄ █ █ ▀ ▄ ██ █▄▄█ █▀▀▌  █▀▀▌  █▄▄█     ██ ██ 
    █    █   █ █▄   ▄▀     █   █ █  █ █   █ █  ▄▀ ▐█ █  █ █  █  █  █  █  █     ▐█ ▐█ 
   ▀        █  ▀███▀        ███     █    █  ███    ▐    █   █     █      █      ▐  ▐ 
           ▀                       █    ▀              █   ▀     ▀      █            
                                  ▀                   ▀                ▀                     
     """)
     self.p = None
     self.continua = True
     self.senha = ''
     self.app = FirebaseApplication(
         'https://thegambiarragame.firebaseio.com', authentication=None)
     self.authentication = FirebaseAuthentication(
         '4PjjnBreuNDHH1vEnFcmURL2nVSNHRHR1vl5voIk',
         '*****@*****.**',
         extra={'id': 123})
     self.app.authentication = self.authentication
     x = ''
     for i in range(11):
         x += '.'
         if len(x) == 4:
             x = ''
         print("", end="\rCarregando" + x)
         time.sleep(.3)
     print("", end="\r")
Beispiel #3
0
 def setUp(self):
     self.SECRET = 'FAKE_FIREBASE_SECRET'
     self.DSN = 'https://firebase.localhost'
     self.EMAIL = '*****@*****.**'
     self.authentication = FirebaseAuthentication(self.SECRET, self.EMAIL,
                                                  None)
     self.firebase = FirebaseApplication(self.DSN, self.authentication)
Beispiel #4
0
def passwordstore(server=env.host_string,
                  service='system',
                  user='******',
                  password=False,
                  verbose=False):
    if nicenametohost(server):
        server = hosttonicename(nicenametohost(server))
    from firebase.firebase import FirebaseApplication, FirebaseAuthentication
    authentication = FirebaseAuthentication(keychain['firebaseapikey'], True,
                                            True)
    fbase = FirebaseApplication(keychain['firebaseappurl'], authentication)
    if password:
        resourcepath = '/passwords/' + server + '/' + service
        data = {user: password}
        if verbose:
            print "Posting " + str(data) + " to " + resourcepath
        result = fbase.patch(resourcepath,
                             data,
                             params={'print': 'pretty'},
                             headers={'X_FANCY_HEADER': 'VERY FANCY'})
        if verbose:
            print result
        return result
    else:
        resourcepath = '/passwords/' + server + '/' + service + '/' + user
        password = fbase.get(resourcepath, None)
        if verbose:
            print resourcepath + ':'
            print password
        return password
Beispiel #5
0
 def setUp(self):
     self.SECRET = 'FAKE_FIREBASE_SECRET'
     self.DSN = 'https://firebase.localhost'
     self.EMAIL = '*****@*****.**'
     self.UID = '123'
     self.authentication = FirebaseAuthentication(
         self.SECRET, self.EMAIL, auth_payload={'uid': self.UID})
     self.firebase = FirebaseApplication(self.DSN, self.authentication)
Beispiel #6
0
 def __init__(self):
     self.app = FirebaseApplication('https://vegans2godatabase.firebaseio.com', authentication=None)
     self.authentication = FirebaseAuthentication('Wg6XvS7W0UftiQlBnCM1tt8gVSIE7exereBXcYx0', '*****@*****.**', extra={'id': 123})
     self.app.authentication = self.authentication
     self.cod_pedido = 0
     self.dic_bebida = {}
     self.dic_comida = {}
     self.produto = Produto()
     self.pedido = []
Beispiel #7
0
 def __init__(self):
     self.app = FirebaseApplication('https://vegans2godatabase.firebaseio.com', authentication=None)
     self.authentication = FirebaseAuthentication('Wg6XvS7W0UftiQlBnCM1tt8gVSIE7exereBXcYx0', '*****@*****.**', extra={'id': 123})
     self.app.authentication = self.authentication
     self.cod_produto = 0
     self.nome = ""
     self.status = ""
     self.descricao = ""
     self.valor = .0
     self.dic_prod = {}
Beispiel #8
0
    def handle_noargs(self, **options):
        admin_auth = FirebaseAuthentication(settings.FIREBASE['secret'],
                                            '*****@*****.**',
                                            admin=True,
                                            debug=True)
        app = FirebaseApp(settings.FIREBASE['base_url'],
                          authentication=admin_auth)
        rules_data = open(settings.NKCHAT_RULES_PATH, 'rb').read()

        app.put_raw('/.settings', 'rules', rules_data)
Beispiel #9
0
    def __store_firebase(self):
        """
        """

        authentication = FirebaseAuthentication(self.__config.get('firebase', 'firebase.database_secret'), None)
        #user = authentication.get_user()
        #print authentication.extra
        #print user.firebase_auth_token

        firebase = FirebaseApplication(self.__config.get('firebase', 'firebase.url'), authentication)
        result = firebase.post(self.__config.get('firebase', 'firebase.path'), self.__data)

        log_success('[+] Stored on firebase: {0}'.format(result['name']))
from firebase.firebase import FirebaseAuthentication
import time
import random
import logging

reload(sys)
sys.setdefaultencoding('utf-8')

# 设置headers
UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36'
HEADERS = {'User-Agent': UA, 'Connection': 'close'}

# firebase配置
FIREBASE_SECRET = "你的firebase配置"
FIREBASE_URL = "你的firebase配置"
AUTH = FirebaseAuthentication(FIREBASE_SECRET, '你的firebase配置')
MYFIREBASE = FirebaseApplication(FIREBASE_URL, None)
MYFIREBASE.authentication = AUTH

# 爬取的类别,默认全部为空
# 2:大胸妹 3:美腿控 4:有颜值 5:大杂烩 6:小翘臀 7:黑丝袜
cid = ''
cid_dict = {
    '': 'all',
    2: 'breast',
    3: 'leg',
    4: 'face',
    5: 'hotpot',
    6: 'buttock',
    7: 'stockings'
}
Beispiel #11
0
    Telegram API ($ pip install python-telegram-bot)
    Firebase ($pip install python-firebase) **note that for now library only works w python 3.6
"""
###############################################################################

from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ParseMode
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler, MessageHandler, ConversationHandler, Filters
import datetime as dt

AuthKey = '638918174:AAGkR-wBtzVHCiOrDGmtgAsyaHluE7IicDU'  #real bot Auth Token
#AuthKey = '762472983:AAG47FPX7S84RYAXlXBg3U5NQ01JtsFZcNo'                      #demo bot Auth Token
from firebase.firebase import FirebaseApplication, FirebaseAuthentication
url = 'https://smufoodchamps.firebaseio.com/'
token = 'CgosBev5DkwojmcMhBh8eIEmMXMoKwzz8T95drKa'  #Firebase Auth Token
email = '*****@*****.**'
fb_auth = FirebaseAuthentication(token, email)
fb = FirebaseApplication(url, fb_auth)

# Enable logging
import logging
logging.basicConfig(
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
    level=logging.INFO)

logger = logging.getLogger(__name__)

#defining state numbers
FINDING, RPT_BLDG, RPT_AREA, RPT_TYPE, RPT_EXP, RPT_CLR = range(6)


#error logging
if __name__ == '__main__':
    """
	configure UART2.  BB_UART.setup() enables UART2 a.k.a. /dev/ttyO2 on Beaglebone
	"""
    BB_UART.setup('UART2')
    """
	Instantiate xbee module with uart serial port at 9600 baud
	"""
    ser = serial.Serial('/dev/ttyO2', 9600)
    xbee = XBee(ser, escaped=True)
    """
	configure firebase settings
	"""
    cf = config()
    auth = FirebaseAuthentication(cf.firebaseSecret, cf.firebaseEmail, True,
                                  True)
    fb = FirebaseApplication(cf.firebaseURL, auth)
    """
	defined commands FROM sensor
	"""
    s_cmds = {
        'Vegetronix': 'V',
        'IR_Low': 'IL',
        'IR_High': 'IH',
        'IR_Sens': 'Se',
        'IR_Slope': 'Sl',
        'MLX_Std': 'M',
        'MLX_Params': 'MP',
        'MLX_Comp': 'MC',
        'Pixel_Offset': 'PO',
        'MLX_PTAT': 'Pt',
Beispiel #13
0
 def __init__(self, requestKey, request):
     self.visitor_id = request
     self.reqKey = requestKey
     self.authentication = FirebaseAuthentication(FIREBASE_SECRET, EMAIL,
                                                  True, True)
     self.firebase = FirebaseApplication(FIREBASE_URL, self.authentication)
Beispiel #14
0
        frozenset(['beer', 'rice', 'apple', 'chicken'])
        """
    file_iter = open(fname, 'rU')
    for line in file_iter:
        line = line.strip().rstrip(',')  # Remove trailing comma
        record = frozenset(line.split(','))
        yield record


def toSort(a):
    return a[1]


if __name__ == "__main__":

    auth = FirebaseAuthentication('<FIREBASE AUTH KEY>', '<GMAIL ID>')
    app = FirebaseApplication('<LINK TO FIREBASE APP>', authentication=auth)
    products = app.get('/product', None)
    productList = {}
    if (products):
        for product, details in products.items():
            productList[product] = [details['name'], details['cost']]

    result = app.get('/user', None)
    month = int(input("Enter the month from which analysis is to be made: "))
    year = int(input("Enter the year from which analysis has to be made: "))
    monthsToAnalyse = int(
        input(
            "Enter the number of months for which the analysis has to be done: "
        ))
    productsArray = []
Beispiel #15
0
    def handle(self, **options):
        admin_auth = FirebaseAuthentication(settings.FIREBASE['secret'],
                                            '*****@*****.**',
                                            admin=True)
        app = FirebaseApplication(
            settings.FIREBASE['base_url'],
            authentication=admin_auth
        )
        offline_users = []
        deletable_users = []

        cleanup = app.put('cleanup', 'users', {'start': {'.sv': 'timestamp'},
                                               'end': False})
        start = cleanup['start']

        logger.info("User cleanup started (force=%s) %d.", options['force'], start)

        all_users = app.get('/', 'users') or {}

        for uid, user in all_users.iteritems():
            username = user.get('name').lower()
            last_online = user.get('onlineAt', 0)
            sessions = user.get('sessions', [])

            session_age = (start - last_online) // 1000

            if session_age > self.ONLINE_TIMEOUT:
                if sessions:
                    logger.info("%s has been offline for %d seconds but appears online, "
                                "deleting online statuses...",
                                username, session_age)
                    offline_users.append(user)
                elif options['force'] is True:
                    logger.info("%s has been offline for %d seconds and appears offline, "
                                "deleting possible online statuses anyway (because "
                                "force=True)",
                                username, session_age)
                    offline_users.append(user)

            logger.debug('%s has been online for %d seconds', uid, session_age)

            if session_age > self.OFFLINE_TIMEOUT:
                logger.info("%s has been offline for %s seconds, deleting user...",
                            username, session_age)
                deletable_users.append(user)

        if deletable_users or offline_users:
            org_ids_online = (app.get('/', 'organization-admins-online') or {}).keys()
            org_keys = ['organization-admins-online/{}'.format(org_id)
                        for org_id in org_ids_online]

            deletables = set()

            for key in ['user-names-online', 'moderators-online', ] + org_keys:
                usernames = (app.get('/', key) or {}).keys()
                for user in offline_users + deletable_users:
                    deletable_username = user['name'].lower()
                    if deletable_username in usernames:
                        deletables.add((key, deletable_username))
                for user in offline_users:
                    if user.get('sessions'):
                        deletables.add(('users/{}'.format(user['id']), 'sessions'))

            deletables = list(deletables)

            for u in deletable_users:
                deletables.append(('users', u['id']))

            for key, username in deletables:
                logger.info('Deleting %s/%s', key, username)
                app.delete(key, username)

        end = app.put('cleanup/users', 'end', {'.sv': 'timestamp'})

        logger.info("User cleanup ended %d.", end)
Beispiel #16
0
#TO WRITE THE PRODUCT LIST 'productsList.csv' INTO FIREBASE REALTIME DATABSE

#sudo pip3 install apyori
#sudo pip3 install requests==1.1.0
#sudo pip3 install python-firebase
#sudo pip3 install requests --upgrade

from firebase.firebase import FirebaseApplication
from firebase.firebase import FirebaseAuthentication
import pandas as pd
auth = FirebaseAuthentication('<FIREBASE AUTH>', '<GMAIL USERID>')
app = FirebaseApplication('<LINK TO FIREBASE APP>', authentication=auth)

inputCSV = pd.read_csv('./productsList.csv', header=None)

numberOfRows = inputCSV.shape[0]
numberOfCols = inputCSV.shape[1]
headings = ['name', 'category', 'cost', 'quantity', 'garbage']
productDetails = {}
for i in range(numberOfRows):
    key = '/product/' + inputCSV.iloc[i, 0]
    for j in range(1, 6):
        if (j == 3 or j == 4):
            productDetails[headings[j - 1]] = int(inputCSV.iloc[i, j])
        else:
            productDetails[headings[j - 1]] = str(inputCSV.iloc[i, j])
    print(key, productDetails)
    app.put('', key, productDetails)
Beispiel #17
0
from firebase.firebase import FirebaseApplication
from firebase.firebase import FirebaseAuthentication
#import for firebase
import time

#===========================FIREBASE ACCESS=======================

app = FirebaseApplication('https://adminflashline.firebaseio.com/',
                          authentication=None)
authentication = FirebaseAuthentication(
    'pt14BYHQUUxMhFoa0Eigtr59aIa3Gyfvwoc209Tu',
    '*****@*****.**',
    extra={'id': 123})
app.authentication = authentication

user = authentication.get_user()

result = app.get('/Ticket/ticketnum', None)
print('===============================')
print('Result: ' + str(result))

resultInc = result + 1
app.put('/Ticket', "ticketnum", resultInc)
result = app.get('/Ticket/ticketnum', None)
print result
time.sleep(4)

resultInc = result + 1
app.put('/Ticket', "ticketnum", resultInc)
result = app.get('/Ticket/ticketnum', None)
print result
Beispiel #18
0
#importing various modules
from firebase import firebase
from firebase.firebase import FirebaseApplication, FirebaseAuthentication

#connecting to firebase database
FIREBASE_SECRET = 'OrbXyqLOPRHI76mpc7cv8UUUVGuI8Uo5XALqt4SN'
FIREBASE_URL = 'https://htn-threatmonitor.firebaseio.com/'

email = '*****@*****.**'
authentication = FirebaseAuthentication(
    FIREBASE_SECRET, email, extra={'id': 'MEnfSGdd6PTC9nsBT2z74jhB3KZ2'})
firebase = FirebaseApplication('https://htn-threatmonitor.firebaseio.com/',
                               authentication)
result = firebase.get('/applications', None)
print result
print authentication.extra
Beispiel #19
0
 def __init__(self, fbUrl, fbEmail, fbSecret):
     self.auth = FirebaseAuthentication(fbSecret, fbEmail, True, True)
     self.fb = FirebaseApplication(fbUrl, self.auth)
Beispiel #20
0
# -*- coding: utf-8 -*-
from flask import Flask, render_template, render_template_string, abort, redirect, url_for, g, request
from firebase.firebase import FirebaseAuthentication, FirebaseApplication
from Project.Imprimir import print_pedido
import getpass
import requests
import sys
import os

app = Flask(__name__)
dbfire = FirebaseApplication('https://vegans2godatabase.firebaseio.com',
                             authentication=None)
authentication = FirebaseAuthentication(
    'Wg6XvS7W0UftiQlBnCM1tt8gVSIE7exereBXcYx0',
    '*****@*****.**',
    extra={'id': 123})
dbfire.authentication = authentication
s = requests.Session()


@app.route('/')
def page():
    return redirect(url_for('pagelogin'))


@app.route('/login')
def pagelogin():
    return render_template('login.html')


@app.route('/index')
Beispiel #21
0
# Local Folders
archiveFolderName = "Archive"  # vairable used to ensure same name used below
archiveFolder = get_folder(archiveFolderName)

# Times to wait
main_loop_delay = 0.1
time_between_check_fb_sockets = 5  # delay between checking for socket changes on Firebase

# Firebase App
log("Initialising Firebase...", False)
fbApp = FirebaseApplication(
    'https://home-automation-project-fa23c.firebaseio.com/',
    authentication=None)

# Firebase Authentication
authentication = FirebaseAuthentication(
    '08hbOtRkv9btYK6obDR43b34rl2yx6BpVs4rgoEN', '*****@*****.**')
fbApp.authentication = authentication

# Firebase socket values
get_fb_sockets(False)

# Last done times
# Defined after fetching FB values
last_check_sockets = int(time.time(
))  # already synced initially above, no need to allow immediately

# Main Loop
while True:

    try:
        # Note: Sensor respones are handled on background thread
Beispiel #22
0
from flask import render_template
from flask import jsonify
from flask import request
from firebase.firebase import FirebaseApplication, FirebaseAuthentication
from app import app
from app.digi import Digi
from app.userConfig import config
from datetime import datetime

myConfig = config()
myDigi = Digi(myConfig.username, myConfig.password)
auth = FirebaseAuthentication(myConfig.firebaseSecret, myConfig.firebaseEmail,
                              True, True)
firebase = FirebaseApplication(myConfig.firebaseURL, auth)


@app.route('/')
def root():
    res = myDigi.listAllStreams().json()
    return render_template('index.html',
                           user={'name': 'Chad'},
                           list=res["list"])


@app.route('/update')
def update():

    current_time = str(datetime.now().time())

    data = {
        "Temperature": request.args.get('temp', 'no_temp'),
Beispiel #23
0
# Importing various modules
from firebase.firebase import FirebaseApplication, FirebaseAuthentication
from config import *
from db import *
import subprocess

authentication = FirebaseAuthentication(FIREBASE_SECRET,
                                        email,
                                        extra={'id': ID})
firebase = FirebaseApplication(FIREBASE_URL, authentication)


def startDaemon():
    subprocess.call("./start.sh", shell=True)
    with open('osVersion.txt', 'r') as f:
        osVersion = f.readlines()
    lines = [line.rstrip('\n') for line in open('applicationList.txt')]
    print(lines[1].split(" "))
    appHashTable = {}
    for i in range(1, len(lines)):
        tempLines = lines[i].split(" ")
        appHashTable[tempLines[0]] = tempLines[1]

    update_server(osVersion, appHashTable)


startDaemon()
 def __init__(self):
     self.IS_SERVER_RUNNING = False
     self.authentication = FirebaseAuthentication(FIREBASE_SECRET, EMAIL,
                                                  True, True)
     self.firebase = FirebaseApplication(FIREBASE_URL, self.authentication)
Beispiel #25
0
def updatecache(k, pair):
	cryptocache[pair] = k.getTickerInfo(pair)['result'][cryptocode[pair]]['a'][0]





if __name__ == "__main__":
	k = kraken()
	ser = serial.Serial('/dev/ttyACM0', baudrate=9600, timeout = 2)
	time.sleep(5)
	SECRET = '6FmRtZWFEupG9O140dJmr86XUfBcWxawvRkYAzar'
	DSN = 'https://scrolling-sign.firebaseio.com'
	EMAIL = '*****@*****.**'
	authentication = FirebaseAuthentication(SECRET,EMAIL, True, True)
	firebase = FirebaseApplication(DSN, authentication)
	data = firebase.get('/data', None)
	mode = data['mode']
	showtext = "booting up..."

	consumer_key = data['twitter']['consumerkey']
	consumer_secret = data['twitter']['consumersecret']
	access_token = data['twitter']['accesstoken']
	access_secret = data['twitter']['accesssecret']

	auth = OAuthHandler(consumer_key, consumer_secret)
	auth.set_access_token(access_token, access_secret)
	api = tweepy.API(auth)

	last = None
import time

from subprocess import call



#class tk_firebase:

##fb = Firebase('https://adminflashline.firebaseio.com/Ticket/')
##childos = fb.child("ticketnum")
##print childos

#===========================FIREBASE ACCESS=======================

app = FirebaseApplication('https://flashline-d440e.firebaseio.com/', authentication=None)
authentication = FirebaseAuthentication('jOflihfoYA1KIIf5Sov98MznVYyQcyo6V47yhsel',
                                        '*****@*****.**', extra={'id': 123})
app.authentication = authentication

user = authentication.get_user()

result = app.get('/Tickets/0/servingNumber', None)
print ('===============================')
print('Result: ' + str(result))




#===========================UI TKINTER=======================
#global variables for methods
buttoncolor = "blue"
cardTaped = False