Esempio n. 1
0
def store_integrated_experiences(parallel=True):
    episodes = get_episodes()
    auth = fb.FirebaseAuthentication(FIREBASE_KEY, ADMIN_EMAIL, ADMIN_PASSWORD)
    fire = fb.FirebaseApplication(FIREBASE_URL, auth)
    i = 0
    mem_pct = psutil.phymem_usage().percent
    if parallel:
        process_pool = Pool(processes=10)
    while i < len(episodes) and mem_pct < 100:
        episode = episodes[i]
        episode_directory, episode_number = episode.key.split('/')
        print str(i) + ' of ' + str(len(episodes)) + ' #' + episode_number
        pre_dir = DQN_ROOT + '/data/s3/episodes/' + episode_directory
        post_dir = INTEGRATE_DIR + episode_directory
        if not os.path.exists(pre_dir):
            os.makedirs(pre_dir)
        pre_filename = pre_dir + episode_number
        post_filename = post_dir + '_' + episode_number + '.snappy'
        if not os.path.exists(pre_filename):
            episode.get_contents_to_filename(pre_filename)
        if os.path.exists(post_filename):
            print post_filename + ' already loaded'
        else:
            if parallel:
                save_snappy_file_pll(episode_directory, episode_number, fire,
                                     post_filename, pre_filename, process_pool)
            else:
                save_snappy_file(episode_directory, episode_number, fire,
                                 post_filename, pre_filename)
        i += 1
    if parallel:
        process_pool.close()
        process_pool.join()
Esempio n. 2
0
def main():
    appconfig = config.getConfiguration(CONFIG_FILE_PATH)
    if appconfig is None:
        message = "Error parsing config file"
        raise Exception(message)

    print appconfig
    required_config_keys = ['firebase']
    for key in required_config_keys:
        if key not in appconfig:
            message = "*** ERROR: key \'%s\' is required" % key
            raise Exception(message)

    dashstats_auth = firebase.FirebaseAuthentication(
        appconfig['firebase']['token'], appconfig['firebase']['email'])
    dashstats = firebase.FirebaseApplication(appconfig['firebase']['url'],
                                             dashstats_auth)
    #database clean up
    #we only need 1440 records to fill a 24h chart with 100 points/ chart resolution 14,4 minutes
    #will leave 1500 records and delete the rest. this increases board start
    records = dashstats.get("stats", None, {'shallow': 'true'})
    print records
    print "total records: %s" % len(records)
    nrecs = len(records) - 1500
    print "records to delete: %s" % nrecs
    if nrecs > 0:
        recs_to_delete = dashstats.get("stats", None, {
            'orderBy': '"timestamp"',
            'limitToFirst': nrecs
        })
        for rec in recs_to_delete:
            print "deleting record %s:%s" % (rec,
                                             recs_to_delete[rec]['timestamp'])
            dashstats.delete("stats", rec)
Esempio n. 3
0
def getPredictedHourlyCount(month, day, hour, minute, sid):
    from firebase import firebase
    authentication = firebase.FirebaseAuthentication('YOUR ACCESS CODE', 'YOUR ID', True, True)
    firebase.authentication = authentication
    user = authentication.get_user()

    if month < 10:
        month = 'm0' + str(month)
    else:
        month = 'm' + str(month)

    if day < 10:
        day = 'd0' + str(day)
    else:
        day = 'd' + str(day)

    if minute >= 45:
        time = hour + 1
    else:
        time = hour

    if time < 10:
        time = 't0' + str(time)
    else:
        time = 't' + str(time)

    firebase = firebase.FirebaseApplication('https://nightwalker-59e4e.firebaseio.com/', None)
    result = firebase.get('/count_prediction_structure/' + month + '/' + day + '/' + time + '/s' + str(int(sid)), '0')

    return result
Esempio n. 4
0
 def __init__(self, config):
     from firebase import firebase
     auth = firebase.FirebaseAuthentication(
         config.get("Firebase", "Secret"), config.get("Firebase", "Email"))
     fb = firebase.FirebaseApplication(config.get("Firebase", "URL"), auth)
     self.firebase = fb
     self.config = config
Esempio n. 5
0
    def __init__(self, app_url: str, user: str, secret: str):
        self.app_url = app_url

        self.auth = firebase.FirebaseAuthentication(secret,
                                                    user,
                                                    extra={'id': "kolhoz"})
        self.worker = firebase.FirebaseApplication(self.app_url, self.auth)
Esempio n. 6
0
def initialize():
    global fb
    url, passwd, mail = read_conf()
    fb = firebase.FirebaseApplication(url, None)
    #f = open("pass.txt")
    auth = firebase.FirebaseAuthentication(passwd, mail, extra={"id": 123})
    fb.authentication = auth
    return
def connect_firebase():
    f = firebase.FirebaseApplication(firebase_url, None)

    #Use secret to access ALL data!i
    # Adjust based on your access requirements.
    f.authentication = firebase.FirebaseAuthentication(firebase_secret,
                                                       firebase_username,
                                                       admin=True)
    return f
Esempio n. 8
0
    def __init__(self):
        firebase_mail = os.environ['FIREBASE_MAIL']
        firebase_secret = os.environ['FIREBASE_SECRET']

        auth = firebase.FirebaseAuthentication(firebase_secret,
                                               firebase_mail,
                                               debug=True,
                                               admin=True)
        self.client = firebase.FirebaseApplication(
            'https://azami.firebaseio.com', authentication=auth)
Esempio n. 9
0
def fire(request, msg):
    FIREBASE_KEY = getattr(settings, "FIREBASE_KEY", None)
     # authentication = firebase.FirebaseAuthentication('THIS_IS_MY_SECRET', '*****@*****.**', extra={'id': 123})
    authentication = firebase.FirebaseAuthentication(FIREBASE_KEY, '*****@*****.**', True, True)
    print(authentication)
    fb = firebase.FirebaseApplication('https://sweltering-heat-9516.firebaseio.com', authentication)
    result = fb.get('/users', None)
    data = {'name': 'Ozgur Vatansever', 'age': 26, 'created_at': datetime.datetime.now()}
    snapshot = fb.post('/users', data)
    return render(request, 'polls/fire.html', {'msg': result})
Esempio n. 10
0
def GetFirebase():
  """Get a Firebase connection, cached in the application context."""
  db = getattr(g, '_database', None)
  if db is None:
    auth = firebase.FirebaseAuthentication(
        config.FIREBASE_SECRET, config.FIREBASE_EMAIL, admin=True)
    db = firebase.FirebaseApplication(
        config.FIREBASE_CONFIG['databaseURL'], authentication=auth)
    g._database = db
  return db
Esempio n. 11
0
def get_firebase_connection(url):
    # Get password from secrets.txt (created manually on each device)
    # This is located in firebase under settings>Service accounts> Database secrets
    # You must be logged in as admin, not as rasmcfall
    with open('secrets.txt', 'r') as f:
        password = f.readline().strip()

    authentication = firebase.FirebaseAuthentication(password, '*****@*****.**',
        extra={'id': utils.get_serial()})
    return firebase.FirebaseApplication(url, authentication=authentication)
def resetStatus(status):
    with open('config.json', 'r') as f:
        config = json.load(f)
    authentication = firebase.FirebaseAuthentication(config["secret"],
                                                     config["email"], True,
                                                     True)
    fb = firebase.FirebaseApplication("https://proj-icarus.firebaseio.com",
                                      authentication)
    data = {'command': status}
    result = fb.patch("/status", data)
Esempio n. 13
0
def GetFirebase():
  """Get a Firebase connection, cached in the application context."""
  db = getattr(g, '_database', None)
  if db is None:
    auth = firebase.FirebaseAuthentication(
        secrets.FIREBASE_SECRET, secrets.FIREBASE_EMAIL, admin=True)
    db = firebase.FirebaseApplication(
        'https://trogdors-29fa4.firebaseio.com', authentication=auth)
    g._database = db
  return db
Esempio n. 14
0
    def __init__(self):
        #Authentication
        FIREBASE_URL = settings.FIREBASE_URL  #
        FIREBASE_KEY = settings.GROUPMEBOT_FIREBASE_SECRET_KEY  #localcreds.get_credentials(firebase=True)
        #FIREBASE_URL = "https://groupmebot-4104f.firebaseio.com/"
        #FIREBASE_KEY = localcreds.get_credentials(firebase=True)

        authentication = firebase.FirebaseAuthentication(
            FIREBASE_KEY, '*****@*****.**', admin=True)
        self.fdb = firebase.FirebaseApplication(FIREBASE_URL,
                                                authentication=authentication)
Esempio n. 15
0
def publish():
    auth = firebase.FirebaseAuthentication(vars.SECRET, vars.EMAIL)
    endpoint = firebase.FirebaseApplication(vars.FB_URL)
    endpoint.authentication = auth

    post = {
        'embed_url': 'https://www.youtube.com/embed/UVsIGAEnK_4',
        'post_id': '2',
        'published': '2015-03-14 19:10'
    }

    Push(endpoint).post(post)
Esempio n. 16
0
    def __init__(self, port, service_name, manager_port, query_mode=False):
        ModularService.__init__(self,
                                port,
                                service_name,
                                manager_port,
                                query_mode=query_mode)
        self.add_upstream("configservice")
        self.wait_for_manager()

        firebaseObjects = self.upstream(
            "configservice").exposed_firebase_login()
        auth = firebase.FirebaseAuthentication(firebaseObjects[2],
                                               firebaseObjects[1])
        self.firebaseObj = firebase.FirebaseApplication(firebaseObjects[0],
                                                        authentication=auth)
Esempio n. 17
0
def players():
    log('players', "fetching player_stats for %d users" % len(vars.USERS))

    stats = Poll().player_stats(vars.USERS)
    if len(stats) == 0:
        log('players', 'no stats, exiting')
        return

    log('players', "recieved %d stats entries" % len(stats))

    auth = firebase.FirebaseAuthentication(vars.SECRET, vars.EMAIL)
    endpoint = firebase.FirebaseApplication(vars.FB_URL)
    endpoint.authentication = auth

    Push(endpoint).player_stats(stats)
    log('players', "pushed %d stats entries to firebase" % len(stats))
Esempio n. 18
0
    def pull_email_data(self):
        # Find these values at https://twilio.com/user/account
        print("Pulling data from Firebase!")
        try:
            firebase_url = os.environ['FIREBASE_URL']
            upcoming_tbd = os.environ['UPCOMING_TBD']

            # Uncomment once authentiaction is activated
            firebase_secret = os.environ['FIREBASE_SECRET']
            firebase_id = os.environ['FIREBASE_ID']
            firebase_email = os.environ['FIREBASE_EMAIL']
            authentication = firebase.FirebaseAuthentication(firebase_secret, firebase_email, extra={'id': firebase_id})
            fb = firebase.FirebaseApplication(firebase_url, authentication=authentication)
            # fb = firebase.FirebaseApplication(firebase_url, None)
            data = fb.get("/emailReminders", None)

            if data is None:
                print("No email data")
            else:
                # Iterate and save this number.
                for key in data:
                    print("Getting %s " % key)
                    d = data[key]

                    print(d)

                    email = d['email']
                    if 'location' in d and d['location'] is not None and d['location'] != '':
                        loc = d['location']
                        location = Location.objects.filter(lat=loc['lat'], lon=loc['lon']).first()
                    else:
                        location = None


                    try:
                        emailReminder = EmailReminder.objects.get(email=email, location=location)
                    except EmailReminder.DoesNotExist:
                        #create new number
                        emailReminder = EmailReminder(email=email, location=location, reminder_date=upcoming_tbd, firebase_id=key)
                        emailReminder.save()

            return True
        except Exception as e:
            print('Something Happened while processing site - %s' % (str(e)))
            return False

        return False
Esempio n. 19
0
def main():
    print config.firebase
    auth = firebase.FirebaseAuthentication(config.firebase['token'],
                                           config.firebase['email'])
    hb = firebase.FirebaseApplication(config.firebase['url'], auth)
    output = {"last_update": {".sv": "timestamp"}}
    # get local ip
    output['local_ip'] = get_local_ip()
    # get local date and time
    output['local_datetime'] = datetime.datetime.now()
    try:
        r = requests.get('https://api.ipify.org')
        output['global_ip'] = r.text
    except requests.exceptions.RequestException as e:
        message = e
    print output
    hb.put('/', config.firebase['machine_name'], output)
Esempio n. 20
0
    def __init__(self, location=None, user=None, command='standby'):
        # initialize Firebase Application connection
        with open('config.json', 'r') as f:
            config = json.load(f)
        self._authentication = firebase.FirebaseAuthentication(
            config["secret"], config["email"], True, True)
        self._fb = firebase.FirebaseApplication(
            "https://proj-icarus.firebaseio.com", self._authentication)

        # Post Initial State
        time = strftime("%Y-%m-%d %H:%M:%S", gmtime())
        data = {
            'command': command,
            'location': location,
            'timestamp': time,
            'user': user
        }
        result = self._fb.patch("/status", data)
        self._state = data
Esempio n. 21
0
def connect_database():
    # Fetch the service account key JSON file contents
    cred = credentials.Certificate(
        'py3s1-6a115-firebase-adminsdk-xvgxd-0c5b534a28.json')

    # Initialize the app with a custom auth variable, limiting the server's access
    initialize_app(
        cred, {
            'databaseURL': 'https://py3s1-6a115.firebaseio.com/',
            'databaseAuthVariableOverride': None,
            'storageBucket': 'py3s1-6a115.appspot.com'
        })
    authentication = firebase.FirebaseAuthentication(
        secret='WlPXKHEM9uNeg1MnrdP9pEkOvFKbFhR1jofuquhx',
        email='*****@*****.**',
    )
    app = firebase.FirebaseApplication('https://py3s1-6a115.firebaseio.com/',
                                       authentication=authentication)
    return app
Esempio n. 22
0
 def run(self):
     while True:
         (superSecret, url) = ('qVIARBnAD93iykeZSGG8mWOwGegminXUUGF2q0ee',
                               'https://1678-scouting-2016.firebaseio.com/')
         auth = fb.FirebaseAuthentication(superSecret,
                                          "*****@*****.**", True,
                                          True)
         firebase = fb.FirebaseApplication(url, auth)
         matches = firebase.get('/Matches', None)
         while True:
             matches = firebase.get('/Matches', None)[1:]
             notCompleted = filter(
                 lambda m: m.get("redScore") == None or m.get("blueScore")
                 == None, matches)
             print "current match is " + str(
                 min(map(lambda m: m['number'], notCompleted)))
             firebase.put('/', 'currentMatchNum',
                          min(map(lambda m: m['number'], notCompleted)))
             time.sleep(5)
Esempio n. 23
0
    def action(self):
        self.trigger_firebase_write = "RAN"
        firebase_url = shared.FIREBASE_URL  # sample: "https://example.firebaseio.com"
        value = "test_value"
        location = ""  # can be any location under the firebase url (e.g. '/users') or blank for root

        secret = shared.FIREBASE_SECRET
        email = shared.FIREBASE_EMAIL  # not really needed. can be blank
        authentication = None
        if secret:
            authentication = firebase.FirebaseAuthentication(secret, email)

        fbase = firebase.FirebaseApplication(firebase_url, authentication)

        result = fbase.post(location,
                            value,
                            params={'print': 'pretty'},
                            headers={'X_FANCY_HEADER': 'VERY FANCY'},
                            connection=None)

        self.fetched = result
Esempio n. 24
0
def matches():
    log('matches', 'fetching stats for %d users' % len(vars.USERS))

    tokens = Poll().match_tokens(vars.USERS)
    if len(tokens) == 0:
        log('matches', 'no tokens, exiting')
        return

    matches = Poll().matches(tokens)
    if len(matches) == 0:
        log('matches', 'no matches, exiting')
        return

    log('matches', "recieved %d match tokens" % len(matches))

    auth = firebase.FirebaseAuthentication(vars.SECRET, vars.EMAIL)
    endpoint = firebase.FirebaseApplication(vars.FB_URL)
    endpoint.authentication = auth

    Push(endpoint).matches(matches)
    log('matches', "pushed %d matches to firebase" % len(matches))
Esempio n. 25
0
    def fetchUpdate(self):
        AIHome.authentication = firebase.FirebaseAuthentication(
            'zxQ4f3gX9DXBBfHbrCupNqlZgVbDay9klY6zXxkz',
            '*****@*****.**',
            extra={'id': 123})
        AIHome.firebase = firebase.FirebaseApplication(
            'https://stapp-48d1b.firebaseio.com/', AIHome.authentication)
        print AIHome.authentication.extra

        AIHome.user = AIHome.authentication.get_user()
        print AIHome.user.firebase_auth_token

        #Data format returned = {u'Relay1ON': 1800, u'Relay1OFF': u'0600'}
        AIHome.results = AIHome.firebase.get('/Relays',
                                             None)  #, {'print': 'pretty'})
        print AIHome.results

        #Commented out for debugging purposes
        print AIHome.results['Relay1ON']
        print AIHome.results['Relay1OFF']

        #Call time comparator method
        self.relayToggle()
Esempio n. 26
0
push_service = FCMNotification(
    api_key='AIzaSyAJAUIw8JlY64FYmft7MfZyyZqlqd18NII')

app = Flask(__name__)
app.config['MYSQL_HOST'] = 'localhost'
app.config['MYSQL_USER'] = '******'
app.config['MYSQL_PASSWORD'] = ''
app.config['MYSQL_DB'] = 'hedb'
dir = dirname(realpath(__file__))
app.config['UPLOAD_FOLDER'] = join(dir, "static\\uploads\\")
app.config['UPLOAD_PATH'] = "static/uploads/"
mysql = MySQL(app)
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'PNG', 'JPG', 'JPEG'}

authentication = firebase.FirebaseAuthentication(
    '9xOiL0GKPgXmUXO85nYFCFg0pj6H0vdzgnVYUuwy', '*****@*****.**')
firebase = firebase.FirebaseApplication(
    'https://newfirebaseapplication-7755a.firebaseio.com/', authentication)

# JSONResponses
# Register Status


@app.route('/')
def hello_world():
    return 'Hello World!'


@app.route('/auth/register/doctor', methods=['POST', 'GET'])
def register_doctor():
    if request.method == 'POST':
Esempio n. 27
0
def main():
    appconfig = config.getConfiguration(CONFIG_FILE_PATH)
    if appconfig is None:
        message = "Error parsing config file"
        raise Exception(message)

    print appconfig
    required_config_keys = ['firebase']
    for key in required_config_keys:
        if key not in appconfig:
            message = "*** ERROR: key \'%s\' is required" % key
            raise Exception(message)

    a = firebase.FirebaseAuthentication(appconfig['firebase']['token'],
                                        appconfig['firebase']['email'])
    f = firebase.FirebaseApplication(appconfig['firebase']['url'], a)

    #run dash-cli getmininginfo
    #dashd should already been started
    getmininginfo = subprocess.check_output([
        "dash-cli", "-datadir=/root/data", "-conf=/root/data/dash.conf",
        "getmininginfo"
    ])
    getmininginfo = json.loads(getmininginfo)
    print getmininginfo

    #run dash-cli masternode count
    masternodecount = subprocess.check_output([
        "dash-cli", "-datadir=/root/data", "-conf=/root/data/dash.conf",
        "masternode", "count"
    ])
    print "masternodecount: %s" % masternodecount

    #update firebase values
    f.put("", "masternodecount", masternodecount)
    f.put("", "lastblock", getmininginfo["blocks"])
    f.put("", "difficulty", round(getmininginfo["difficulty"], 2))
    hashrate = round(float(getmininginfo["networkhashps"]) / 1000000000, 2)
    f.put("", "hashrate", hashrate)

    #run dash-cli spork show
    spork = subprocess.check_output([
        "dash-cli", "-datadir=/root/data", "-conf=/root/data/dash.conf",
        "spork", "show"
    ])
    spork = json.loads(spork)
    payment_enforcement = "On"
    unix_time_now = datetime.datetime.utcnow()
    unix_time_now = unix_time_now.strftime("%s")
    print "unix_time_now: %s" % unix_time_now
    print "SPORK_1_MASTERNODE_PAYMENTS_ENFORCEMENT: %s" % spork[
        "SPORK_1_MASTERNODE_PAYMENTS_ENFORCEMENT"]

    #check if masternode payments enforcement is enabled
    if int(spork["SPORK_1_MASTERNODE_PAYMENTS_ENFORCEMENT"]) > int(
            unix_time_now):
        payment_enforcement = "Off"

    #update firebase values
    f.put("", "enforcement", payment_enforcement)

    #get average DASH-BTC from cryptsy, bittrex and bitfinex
    DashBtc = {
        'cryptsy': {
            'url':
            'http://pubapi2.cryptsy.com/api.php?method=singlemarketdata&marketid=155',
            'fn_price': get_price,
            'exchange': 'cryptsy',
            'market': 'DRK'
        },
        'bittrex': {
            'url':
            'https://bittrex.com/api/v1.1/public/getticker?market=btc-dash',
            'fn_price': get_price,
            'exchange': 'bittrex',
            'market': 'DRK'
        },
        'bitfinex': {
            'url': 'https://api.bitfinex.com/v1/pubticker/DRKBTC',
            'fn_price': get_price,
            'exchange': 'bitfinex',
            'market': 'DRK'
        }
    }

    avg_price_dashbtc = []
    for key, value in DashBtc.iteritems():
        try:
            r = requests.get(value['url'])
            try:
                output = json.loads(r.text)
                price = value['fn_price'](output, value['exchange'],
                                          value['market'])
                if price is not None:
                    avg_price_dashbtc.append(price)
            except Exception as e:
                print e
                print "Could not get price from %s:%s" % (value['exchange'],
                                                          value['market'])
        except requests.exceptions.RequestException as e:
            print e
            print "Could not get price from %s:%s" % (value['exchange'],
                                                      value['market'])
    print "avg_price_dashbtc: %s" % avg_price_dashbtc
    if len(avg_price_dashbtc) > 0:
        DASHBTC = reduce(lambda x, y: x + y,
                         avg_price_dashbtc) / len(avg_price_dashbtc)
        print avg_price_dashbtc
        print "AVG DASHBTC: %s" % round(DASHBTC, 5)
        f.put("", "priceBTC", round(DASHBTC, 5))

    #get average BTC-USD from btce, bitstamp, bitfinex
    BtcUsd = {
        'btce': {
            'url': 'https://btc-e.com/api/3/ticker/btc_usd',
            'fn_price': get_price,
            'exchange': 'btce',
            'market': 'btc_usd'
        },
        'bitstamp': {
            'url': 'https://www.bitstamp.net/api/ticker/',
            'fn_price': get_price,
            'exchange': 'bitstamp',
            'market': 'BTCUSD'
        },
        'bitfinex': {
            'url': 'https://api.bitfinex.com/v1/pubticker/BTCUSD',
            'fn_price': get_price,
            'exchange': 'bitfinex',
            'market': 'BTCUSD'
        },
        'okcoin': {
            'url': 'https://www.okcoin.com/api/v1/ticker.do?symbol=btc_usd',
            'fn_price': get_price,
            'exchange': 'okcoin',
            'market': 'BTCUSD'
        },
    }
    avg_price_btcusd = []
    for key, value in BtcUsd.iteritems():
        try:
            r = requests.get(value['url'])
            try:
                output = json.loads(r.text)
                price = value['fn_price'](output, value['exchange'],
                                          value['market'])
                if price is not None:
                    avg_price_btcusd.append(price)
            except Exception as e:
                print e
                print "Could not get price from %s:%s" % (value['exchange'],
                                                          value['market'])
        except requests.exceptions.RequestException as e:
            print e
            print "Could not get price from %s:%s" % (value['exchange'],
                                                      value['market'])
    if len(avg_price_btcusd) > 0:
        BTCUSD = reduce(lambda x, y: x + y,
                        avg_price_btcusd) / len(avg_price_btcusd)
        print avg_price_btcusd
        print "AVG BTCUSD: %s" % round(BTCUSD, 8)
        f.put("", "priceBTCUSD", "$%s" % round(BTCUSD, 2))
        DASHUSD = "$%s" % round(float(BTCUSD * DASHBTC), 2)
        print "DASHUSD: %s" % DASHUSD
        f.put("", "price", DASHUSD)

    #get total coins supply from Chainz
    try:
        r = requests.get(
            "http://chainz.cryptoid.info/dash/api.dws?q=totalcoins")
        int_total_coins = r.text.split(".")[0]
        try:
            #validate request
            int(int_total_coins)
            inv_total_coins = int_total_coins[::-1]
            availablesupply = ",".join(chunks(inv_total_coins, 3))[::-1]
            print "Available supply: %s" % availablesupply
            f.put("", "availablesupply", availablesupply)
        except ValueError:
            #reply is not an integer
            print "chainz reply is not valid"
    except requests.exceptions.RequestException as e:
        print e

    #timestamp is given by firebase server
    f.put("", "timestamp", {".sv": "timestamp"})
Esempio n. 28
0
from datetime import datetime
import os
from firebase import firebase
import requests

firebase_url = "https://souschef-182502.firebaseio.com"
souschef_url = "https://souschef-182502.appspot.com"
firebase_secret = os.environ["FIREBASE_SECRET"]

fb = firebase.FirebaseApplication(
    firebase_url, firebase.FirebaseAuthentication(firebase_secret, ''))

# --------------- Helpers that build all of the responses ----------------------


def build_speechlet_response(title, output, reprompt_text, should_end_session):
    return {
        'outputSpeech': {
            'type': 'PlainText',
            'text': output
        },
        'card': {
            'type': 'Simple',
            'title': "SousChef - " + title,
            'content': output
        },
        'reprompt': {
            'outputSpeech': {
                'type': 'PlainText',
                'text': reprompt_text
            }
def upload_metadata(metadata):
    authentication = firebase.FirebaseAuthentication(
        FIREBASE_TOKEN, None, extra={'uid': 'data-export-worker'})
    database = firebase.FirebaseApplication(
        'https://virginiacourtdata.firebaseio.com', authentication)
    database.put('/', 'data', metadata)
Esempio n. 30
0
#import sys
from leituraRFID import leituraRFID
from classes import Cliente, Produto, Venda
from firebase import firebase
from firebase.firebase import FirebaseAuthentication, FirebaseApplication
from database import getClient, getProduct, listProduct, autenticacao, pagamento

if __name__ == '__main__':

    authentication = firebase.FirebaseAuthentication('key', 'e-mail', True,
                                                     True)
    firebase = FirebaseApplication('link', authentication)

    # iniciando o sistema
    print("iniciando o sistema")

    # leitura dos produtos
    print("passe os produtos")

    # leituraRFID()

    # finalizando a venda
    print("finalizando a venda")
    print('\n')

    #lista para teste sem módulo
    listTag = [
        '2200D879C9', '2200D879CA', '2200D879C4', '2200D879C8', '2200D879C7'
    ]

    valor_final = listProduct(listTag, firebase)