コード例 #1
0
            else:
                logging.debug("[+]Topic post 'get' error...\n"
                              "{0}".format(response.status))


if __name__ == "__main__":
    logging.basicConfig(level=logging.DEBUG)
    logging.debug("[+]App started...")

    # Starting scrapp posts
    parser = Scraper(1)
    data = parser.start()

    # Create DS, watch DS list...
    data_store = DataStore()
    data_store.get_ds_list()
    # Set DS type as json file and write first 21 records.
    data_store.set_ds_type("json")
    ds = data_store.create_data_store()
    ds.connect()

    for row in data[:21]:
        ds.insert_unique(*row)

    #Set DS type as csv file and write all remaining records.
    data_store.set_ds_type("csv")
    ds = data_store.create_data_store()
    ds.connect()
    
    for row in data[22:]:
        ds.insert_unique(*row)