def main(): Pipe( Timer(delay=1, max_time=10), Branch(very_slow), print, ) 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()
def main(): Pipe(range(10), range(10), Branch(op_sum, print)) BotFlow.run() print(op_sum)