Open Plantbook SDK

raw JSON →
0.6.1 verified Fri May 01 auth: no python

Python SDK for the Open Plantbook API, providing access to a crowdsourced database of plant species. Current version 0.6.1, released on PyPI with monthly cadence. Supports Python >=3.9.

pip install openplantbook-sdk
error ModuleNotFoundError: No module named 'openplantbook_sdk'
cause Wrong import path or package not installed.
fix
Install the package: pip install openplantbook-sdk. Then import correctly: from openplantbook_sdk import OpenPlantbookClient
error TypeError: search_plants() missing 1 required positional argument: 'q'
cause The 'q' parameter is mandatory.
fix
Call the method with a query: client.search_plants(q='monstera')
error openplantbook_sdk.exceptions.AuthenticationError: Client id or secret invalid
cause Invalid or missing API credentials.
fix
Ensure CLIENT_ID and CLIENT_SECRET are set correctly. Obtain from https://open.plantbook.io.
gotcha API credentials must be obtained separately from the Open Plantbook website. The SDK does not provide default keys.
fix Register at https://open.plantbook.io and create an application to get client_id and client_secret.
gotcha The search_plants method requires the 'q' parameter (query string). Omitting it raises a TypeError.
fix Always pass a query string, e.g., client.search_plants(q='monstera').
gotcha The SDK may use rate limiting; frequent requests without delays may result in HTTP 429 errors.
fix Implement exponential backoff or respect the Retry-After header.

Initialize client with API credentials (from environment variables) and perform a search.

from openplantbook_sdk import OpenPlantbookClient

client = OpenPlantbookClient(
    client_id=os.environ.get('OPB_CLIENT_ID', ''),
    client_secret=os.environ.get('OPB_CLIENT_SECRET', '')
)
plants = client.search_plants(q='monstera')
print(plants)