Beispiel #1
0
def main():
    Pipe(
        range(10),
        Join(double, triple),
        plus_one,
        plus_one,
        Zip(n_stream=2),
        print_out,
    )

    BotFlow.render('ex_output/blockedjoin')
    BotFlow.run()
def main():

    hget = HttpLoader(timeout=2)

    Pipe(
        Timer(delay=3, max_time=5),
        Join(
            Return("https://api.kraken.com/0/public/Ticker?pair=XBTUSD", hget,
                   parse_kraken),
            Return(
                "https://bittrex.com/api/v1.1/public/getticker?market=USD-BTC",
                hget, parse_bittrex),
        ),
        print,
    )

    BotFlow.render('ex_output/bitcoin_arbitrage')
    BotFlow.run()
def main():
    words = ['贸易战', '世界杯']
    baidu_url = 'https://www.baidu.com/s?wd=%s'
    urls = [baidu_url % (word) for word in words]




    outputfile=AioFile('ex_output/baidu.txt')
    Pipe(
        urls,
        HttpLoader(),
       Branch(get_all_items,outputfile),
       Branch(get_all_page_url, HttpLoader(), get_all_items, outputfile),

    )
    #生成流程图
    BotFlow.debug_print()
    BotFlow.render('ex_output/baiduspider')
    BotFlow.run()
Beispiel #4
0
def main():

    httpload = HttpLoader(timeout=2)
    Pipe(
        Timer(delay=2, max_time=5),
        Join(
            Return("https://api.kraken.com/0/public/Ticker?pair=XBTUSD",
                   httpload, parse_kraken),
            Return(
                "https://bittrex.com/api/v1.1/public/getticker?market=USD-BTC",
                httpload, parse_bittrex),
            Return("https://www.bitstamp.net/api/ticker/", httpload,
                   parse_bitstamp),
            Return("https://api.bitfinex.com/v1/ticker/btcusd", httpload,
                   parse_bitfinex),
            Return("https://bitpay.com/api/rates", httpload, parse_bitpay),
            Return("http://api.coindesk.com/v1/bpi/currentprice.json",
                   httpload, parse_coindesk),
        ), Zip(n_stream=6), print_list)

    BotFlow.render('ex_output/bitcoin_arbitrage')
    BotFlow.run()
Beispiel #5
0
class C:
    pass

def only_a(data):
    if not isinstance(data,A):
        raise Exception()

def check_stop(i):
    if i>10:
        BotFlow.stop()

    return i

Pipe(
    Join(
        "a","b","c"

    ),
    Zip(n_stream=3),
    lambda r:'l_'+r,
    print,


)


BotFlow.render("ex_output/test")
BotFlow.run()