Skip to content
A Trefle API Library.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Add circleci. Apr 16, 2019
docs Editing documentation. Apr 27, 2019
shamrock
tests Fixing and testing exceptions. Apr 26, 2019
.gitignore
.isort.cfg
.pre-commit-config.yaml Add pre-commit strategy. Apr 18, 2019
AUTHORS.rst Adding authors to docs. Apr 26, 2019
CONTRIBUTING.rst Editing documentation. Apr 27, 2019
HISTORY.rst Rearrange documentation to include README. Apr 26, 2019
LICENSE Add setup support. Apr 19, 2019
MANIFEST.in Improve setup by adding twine. Apr 26, 2019
Pipfile Improve setup by adding twine. Apr 26, 2019
Pipfile.lock Improve setup by adding twine. Apr 26, 2019
README.rst
setup.py

README.rst

Shamrock - A Trefle API Library

Coverage Status Documentation Status

Shamrock is a Python shallow API library for Trefle integration. It enables interacting with the Trefle plants API in Python to get the information needed for various things you might want to use the API with such as research, gardening software, automation, etc. It is made for use with Python 3.6 and above.

For the full documentation refer to Shamrock documentation.

For more information what the Trefle service provides, refer to the Trefle API documentation. It is also useful for checking out how to use the API with Shamrock library.

Installation

pipenv install shamrock

or

pip install shamrock

Simple Usage Example

from shamrock import Shamrock
api = Shamrock('mytoken')
species = api.species()

Advanced Usage

You can configure the API initially like this:

api = Shamrock(TOKEN, page_size=10)

Currently, page_size is the only available option.

Methods that can be run with the API are:

api.kingdoms()
api.subkingdoms()
api.divisions()
api.families()
api.genuses()
api.plants()
api.species()

They correspond to the Trefle API endpoints.

You can also query a specific item from the database:

api.plants(103505)

Searching is covered with a separate method:

api.search("tomato")

Navigating the API is covered with these methods:

api.next()
api.prev()
api.first()
api.last()

It will work only if you previously made a request. For example:

api.species()
api.next()

By default, the API responds with the list of whatever number is set in the Trefle. You can manipulate it with previously mentioned page_size:

api.species(page_size=5)

You can also use the varoius query string options described on Trefle API documentation as keyword arguments in methods:

api.species(common_name="blackwood")
You can’t perform that action at this time.