anybot package¶
Submodules¶
anybot.action module¶
-
class
anybot.action.Action(only_during_daylight=False)[source]¶ Bases:
objectContinuous Action that executes in steps over time
-
day_begins_at= 7¶
-
day_ends_at= 24¶
-
done= False¶
-
random_interval= 0¶
-
-
class
anybot.action.CandidateActions(action, per_hour=30, min_candidates=100)[source]¶ Bases:
anybot.action.QueuedActions
-
class
anybot.action.QueuedActions(per_interval=30, interval=3600, **kwargs)[source]¶ Bases:
anybot.action.ActionAction that can queue commands and then execute them sequentially at a rate of ‘per_interval’ commands in the time ‘interval’. :param per_interval: number of actions to execute in one interval :param interval: time in seconds for interval
anybot.bot module¶
-
class
anybot.bot.Bot(api, actions=())[source]¶ Bases:
object-
add_action(action)[source]¶ Add an Action to the queue of actions. This does not start the action, it only creates a Thread ready to execute it. :param action: function or instance of Action :return:
-
close(block=True)[source]¶ Stop and remove all currently running actions :param block: Whether to wait for actions to be stopped
-
remove_action(_id)[source]¶ Remove an Action from the queue of actions. Once this is done the Bot cannot restart the action. :param _id:
-
run(threaded=False)[source]¶ Run the Bot, executing all actions, even ones added in the future :param threaded: Whether to block or defer the main loop to a Thread
-
running¶ Is the bot running and available to submit Actions :return: boolean: running
-
anybot.cli module¶
Console script for anybot.
anybot.utils module¶
-
anybot.utils.ensure_time(wait)[source]¶ Ensure the executed code takes at least ‘wait’ seconds to complete :param wait: max number of seconds to wait after execution
-
anybot.utils.only_daylight_hours(wakeup_at=7, sleep_at=24, random_add=0)[source]¶ Only execute code during the day (mimics a human sleep cycle) :param wakeup_at: hour to begin executing :param sleep_at: hour to stop executing :param random_add: interval for random wait after expected time
Module contents¶
Top-level package for Anybot API Automation.
-
class
anybot.Bot(api, actions=())[source]¶ Bases:
object-
add_action(action)[source]¶ Add an Action to the queue of actions. This does not start the action, it only creates a Thread ready to execute it. :param action: function or instance of Action :return:
-
close(block=True)[source]¶ Stop and remove all currently running actions :param block: Whether to wait for actions to be stopped
-
remove_action(_id)[source]¶ Remove an Action from the queue of actions. Once this is done the Bot cannot restart the action. :param _id:
-
run(threaded=False)[source]¶ Run the Bot, executing all actions, even ones added in the future :param threaded: Whether to block or defer the main loop to a Thread
-
running¶ Is the bot running and available to submit Actions :return: boolean: running
-
-
class
anybot.Action(only_during_daylight=False)[source]¶ Bases:
objectContinuous Action that executes in steps over time
-
day_begins_at= 7¶
-
day_ends_at= 24¶
-
done= False¶
-
random_interval= 0¶
-
-
class
anybot.QueuedActions(per_interval=30, interval=3600, **kwargs)[source]¶ Bases:
anybot.action.ActionAction that can queue commands and then execute them sequentially at a rate of ‘per_interval’ commands in the time ‘interval’. :param per_interval: number of actions to execute in one interval :param interval: time in seconds for interval