Exemplo n.º 1
0
def unsubscribe():
    messenger_user_id = request.args.get('messenger user id')

    user = Firebase('https://welse-141512.firebaseio.com/ocz/' + str(messenger_user_id))
    user.remove()

    message = {
        "messages": [
            {"text": u"เรียบร้อยยย!"}
        ]
    }
    return jsonify(message)
Exemplo n.º 2
0
    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 })
Exemplo n.º 3
0
                time.sleep(12 * 60)


            break
        except:
            print("Download Error")

    if notReady:
        time.sleep(180)

print("READY!")

while True:
    try:
        pipeline = Firebase("https://sv2.firebaseio.com/pipeline")
        pipeline.remove()
        # pipeline.update({"market_ready":"market_ready"})

        #can kick subsequent analysis to start

        status = Firebase("https://sv2.firebaseio.com/status")
        status.update({"decision_data":datetime.now().strftime('%Y-%m-%d %H:%M:%S')})
        break
    except:
        print("Upload Error")



#add stocks to pipeline

client = pubsub.Client.from_service_account_json('/banshee/credentials.json', 'money-maker-1236')
Exemplo n.º 4
0
def clear_firebase():
    a = f.get()
    if a != None:
        for i in a:
            q = Firebase('https://huafhoi.firebaseio.com/items_filter')
            q.remove()
Exemplo n.º 5
0
def clear_firebase():
    a = f.get()
    if a != None:
        for i in a:
            q = Firebase('https://welse-141512.firebaseio.com/items' + '/' + i)
            q.remove()
Exemplo n.º 6
0
    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
                    """
Exemplo n.º 7
0
# -*- coding: UTF-8 -*-
import sys as Sys
import csv
import json
import glob
import requests
from firebase import Firebase
from firebase_token_generator import create_token

auth_payload = {"uid": "ySsRm3jHsmfGcI1uf79ZIvGJvwx1"}
token = create_token("TDffFFSZK6P8MFJM4WZA0itwuil406XejqJ7nIl0", auth_payload)

fire = Firebase('https://eat-here-or-there.firebaseio.com/nyc/inspections', token)

fire.remove()
fieldnames = ['CAMIS', 'INSPECTION DATE', 'ACTION', 'VIOLATION CODE', 'VIOLATION DESCRIPTION', 'CRITICAL FLAG', 'SCORE', 'GRADE', 'GRADE DATE', 'RECORD DATE', 'INSPECTION TYPE']
# Print iterations progress
def printProgress (iteration, total, prefix = '', suffix = '', decimals = 2, barLength = 100):
    """
        Call in a loop to create terminal progress bar
        @params:
        iteration   - Required  : current iteration (Int)
        total       - Required  : total iterations (Int)
        prefix      - Optional  : prefix string (Str)
        suffix      - Optional  : suffix string (Str)
        decimals    - Optional  : number of decimals in percent complete (Int)
        barLength   - Optional  : character length of bar (Int)
        """
    filledLength    = int(round(barLength * iteration / float(total)))
    percents        = round(100.00 * (iteration / float(total)), decimals)
    bar             = '#' * filledLength + '-' * (barLength - filledLength)
Exemplo n.º 8
0
def clear_firebase():
    q = Firebase('https://welse-141512.firebaseio.com/movies')
    if q != None:
        q.remove()