A simple wrapper for the trefle botanical RESTAPI
Project description
Trefle-Api
Trefle-API is a simple python API wrapper for the trefle botanic data API
>>> from trefle_api import TrefleAPI
>>> Client = TrefleAPI(token="trefle_api_token")
>>> Query = Client.search("rose").in_("plants").filter(family="Rosaceae").sort_by(slug="asc")
>>> Query.get_json()
"{'data': [{'id': 265580, 'common_name': 'Field rose', 'slug': 'rosa-arvensis', 'scientific_name': 'Rosa arvensis'..."
>>> New_Query = Query.range(year=[2000, 2010]).exclude(common_name="null")
>>> New_Query.get_models()
"[[Plant(id=345576, name='', slug='physaria-purpurea', common_name='Rose bladderpod', scientific_name='Physaria purpurea', year=2002,..."
This package allows you to build simple to more complex queries to fetch data from the the trefle RESTAPI
Query tags :
-
search()
description : search a query
args : q # the string to use as query returns : a copy of theQuery
class to allow chaining -
retrieve()
description : retrieve an item based on it's slug or id
args : slug or id # a string representing the slug of a vegetable or it's id in the trefle api records
returns : a copy of theQuery
class to allow chaining -
in_()
description : select a category in which to search or retrieve
args category # available categories are :- kingdoms
- subkingdoms
- divisions
- divisionclasses
- division_orders
- families
- genus
- plants
- species
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for trefleapi-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03ec137fcf09f340f9ba39cf5e327340793a50055950a8300716fcc998fe4944 |
|
MD5 | fa5b85a653a7c4cd20b88901dfc6da4b |
|
BLAKE2b-256 | cba760b4b4087a62e74eed29d021e7d99db1c15d83c24708cbdc8e2d0f1feea9 |