Introduction
Welcome to the BotFleet Python SDK! The SDK provides a simple interface to interact with the BotFleet REST API.
Usage
You can install the SDK via pip
:
pip install botfleet
Once installed, you can use it to make requests:
import botfleet
botfleet.api_key = "YOUR_API_KEY"
bot = botfleet.Bot.retrieve(id="15d19ca3-26f1-4adb-9cea-3955b73d9b4e")
execution = bot.execute()
Resources
The sections below provide a basic overview of the SDK's resources and their relationships.
BotBuilderJob
A BotBuilderJob
is automatically created every time a Bot
is created or if a Bot
's python_version
or requirements
attribute is updated. BotBuilderJob
produces a Build
.
BotBuilderJob
and Build
can't be created manually. They are created automatically by BotFleet. You can simply list and retrieve them for information purposes.
BotExecutorCronJob
You can create a BotExecutorCronJob
to schedule a Bot
to be executed periodically. BotExecutorCronJob
produces Execution
s. You can suspend and resume a BotExecutorCronJob
at any time by changing its status
attribute.
BotExecutorJob
You can create a BotExecutorJob
to execute a Bot
once. BotExecutorJob
produces an Execution
. BotExecutorJob
is created every time you manually execute a Bot
from the UI on https://app.botfleet.ai or when you invoke the execute
method on a Bot
object.
BotTemplate
A BotTemplate
is a template for creating a Bot
. It's purpose is to have pre-defined values that can be used to create a Bot
without having to specify them every time. create_from_template
method on Bot
accepts a template_id
and creates a Bot
with the values defined in the BotTemplate
.
Bot
A Bot
can be created from scratch or from a BotTemplate
. Bot
can be scheduled to be executed periodically via BotExecutorCronJob
or executed once via BotExecutorJob
.
Build
Created by BotBuilderJob
. Signifies a single build of a Bot
. A bot can be rebuilt unlimited times.
Execution
Created by BotExecutorJob
or BotExecutorCronJob
. Signifies a single execution of a Bot
.
Store
A Store
is a key-value database. It can be attached to any number of bots. Attachment happens during bot creation. Accessing a Store
from a Bot
is done via the store
argument of the main
function:
def main(request, store):
store["foo"] = "bar"
return store["foo"]