Welcome to databot’s world!¶
The databot applicaton is made with one or many pipes and run by `BotFrame.run()`
.
The simplest applicaton looks like:
Pipe(print)
BotFrame.run()
Concept of the databot is very simple. `I doubt if it is good to write a guide :-)`
Pipe works at the Top level. It combines the Node and Route together.
Node is callable: in python world, we have three callable things:
- function
- function object. Class with
`__call__`
function overridden - lambada
Route is for duplicating data for multiple purposes. for simple applicaiton, you don’t need route. Just a main pipe.
- case 1: when get a tick bitcoin price from api,
- you want save it to file and mysql at same time.
Pipe(
get_price,
Branch(save_to_db),
save_to_file
)
case 2: crawler gets a google search result page. It may need to parse search result and next page link .
Pipe(
"https://www.google.com/search?q=kkyon+databot",
HttpLoader(),
Branch(parse_search_result,save_to_db),
parse_all_page_url,
HttpLoader(),
parse_search_result,
save_to_db
)
The above two code blocks look like pseudo code, but they are workable samples.
Warning
In this documentationm. Data, Message, Event are the same thing.