Esempio n. 1
0
def main(urls):
    configs = ConfSpyPy.load('spypy.cfg')

    dataspypy = DataSpyPy(configs['host'], configs['port'])

    procspypy = ProcSpyPy(dataspypy, configs['google_analytics'], configs['google_adsense'])
    procspypy.process_urls(urls)
Esempio n. 2
0
def callback(ch, method, properties, body):
    try:
        configs = ConfSpyPy.load('spypy.cfg')
        dataspypy = DataSpyPy(configs['host'], configs['port'])
        procspypy = ProcSpyPy(dataspypy, configs['google_analytics'], configs['google_adsense'])
        procspypy.process_document(loads(body))
        ch.basic_ack(delivery_tag=method.delivery_tag)
    except Exception, e:
        print e
Esempio n. 3
0
def main():
    start = time.time()

    if len(sys.argv) < 2:
        print 'Please, specify a number of records to process and regular expression (optional)!'
        sys.exit(1)

    configs = ConfSpyPy.load('spypy.cfg')

    dataspypy = DataSpyPy(configs['host'], configs['port'])
    procspypy = ProcSpyPy(dataspypy, configs['google_analytics'],
                          configs['google_adsense'])
    queue = Queue.Queue()

    for i in range(configs['threads']):
        dp = DocumentProcessor(queue, procspypy)
        dp.setDaemon(True)
        dp.start()

    records = dataspypy.get_unprocessed_records(
        int(sys.argv[1]), sys.argv[2] if len(sys.argv) == 3 else None)
    for record in records:
        queue.put(record)

    queue.join()

    print "Elapsed Time: %s" % (time.time() - start)