Python
Use Python to communicate directly with FarmBot and the API
FarmBot, Inc. provides a Python wrapper library, farmbot-py, that provides authentication and communication utilities for communicating with FarmBot devices directly via the message broker and for manipualting account data stored in the FarmBot Web App via the REST API.
The library can be used when running Python code from another device such as a laptop, server, or another Raspberry Pi. The library’s functions cannot currently be used to run code on the FarmBot device itself.
Getting started
To start a project using the FarmBot Python library, create and activate a virtual environment and install the farmbot
package:
python3 -m venv py_venv
source py_venv/bin/activate
python -m pip install --upgrade farmbot
The library can then be used via from farmbot import Farmbot
as shown in examples in the following pages.
Options available
When applicable, the following pages provide usage examples of the FarmBot Python library. Examples without usage of the FarmBot library are also provided.
What’s next?
- Authorization
Use Python to get a token for authorizing requests
- Settings
Configure verbosity, timeouts, and cache settings for the FarmBot Python library
- Functions
Directory of functions included in the FarmBot Python library
- Examples
Examples showcasing various ways in which you might use the FarmBot Python library to augment and expand upon your FarmBot’s capabilities.