from webParser import Builder
from webParser.base import Pipeline

__author__ = 'Girish'

import falcon
import  threading

semaphore = Semaphore()



api = app = falcon.API()
table = RestTable(Entry(id=1,name="girish"),Entry(id=2,name="shivam"))
pipeline =Pipeline(Builder)
gen_data = pipeline.yield_data()
data = RestTable(*gen_data)


def update_data():
    global gen_data,data

    while True:
        semaphore.acquire()
        gen_data = pipeline.yield_data()
        data.clear()
        data.extend(gen_data)
        semaphore.release()

        print("updated the gen_data")
        sleep(60)
    def test_pipeline(self):
        pipeline = Pipeline(Builder)

        for dat in pipeline.yield_data():
            print(dat)