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 comment
  • user (ID) – handler for the commenting user
  • parent (ID) – handler for entry the comment is responding to
  • description (str) – comment content
  • created (str) – datetime the post was created
  • like_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 comment dictionary of the structure above contains the following key/value pairs:

  • id (ID) – handler for the comment
  • user (ID) – handler for the commenting user
  • parent (ID) – handler for entry the comment is responding to
  • description (str) – comment content
  • created (str) – datetime the post was created
  • like_count (int) – number of users who have liked the post

Get an app link to the user or app based on the id

Abstract Resource