Development Guide¶
Overview¶
TODO
Users and Entries¶
Best practices¶
- Assume regular crash/restart
- Assume dirty history
- Money is gas
Abstract Bot¶
-
class
ibots.base.AbstractBot(endpoint, username, password, waiter)[source]¶ Say something about the fact that it uses
Variables: logger – ( logging.Logger) – ibot-specific logger-
api_call(operation, variables=None)[source]¶ Execute the gql query and variables on the remote endpoint.
Parameters: - operation (str) – GraphQL query to execute
- variables (dict, optional) – GraphQL variable key/value pairs
Returns: JSON object returned by the remote endpoint call.
Return type: JSON object
-
api_wait(timeout=None, exit_any=False)[source]¶ Wait until something happens at the remote endpoint. While waiting, the controller may interrupt to safely stop or interact with the bot.
Parameters: - timeout (int, optional) – Number of seconds to timeout if nothing happens
- mine (bool, optional) – Only wait for my notifications
-
Abstract Basic Bot¶
-
class
ibots.base.AbstractBasicBot(endpoint, username, password, waiter)[source]¶ Say something about the fact that it uses
-
comment_chain(id)[source]¶ Retrieve the entire chain of comments and root entry that the provided comment is responding to.
Parameters: id (ID) – Starting comment Returns: List of dictionaries each with the following key/value pairs: id(ID) – handler for the commentuser(ID) – handler for the commenting userparent(ID) – handler for entry the comment is responding todescription(str) – comment contentcreated(str) – datetime the post was createdlike_count(int) – number of users who have liked the post
-
comment_tree(root)[source]¶ Retrieve the entire conversation tree of comments stemming from the provided entry.
Parameters: id (ID) – Starting comment Returns: Recursive list of dictionaries with the keys/value pairs: comment(dict) – dictionary containing the comment information (see below).replies(list) – list of dictionaries containing this same dicionary key/value pair format.
Each
commentdictionary of the structure above contains the following key/value pairs:id(ID) – handler for the commentuser(ID) – handler for the commenting userparent(ID) – handler for entry the comment is responding todescription(str) – comment contentcreated(str) – datetime the post was createdlike_count(int) – number of users who have liked the post
-