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
File details
Details for the file trefleapi-0.1.0.tar.gz
.
File metadata
- Download URL: trefleapi-0.1.0.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cdde11592045d93277e8481ea3524f99bcda44959eb94a78cf79f0d4aece054 |
|
MD5 | cb7dc6ea2174f001773c2efd2c0ffb20 |
|
BLAKE2b-256 | cbb732836fcc620ba9be6015aba39ac88a11f4dde119d5258551d0f80568c095 |
File details
Details for the file trefleapi-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: trefleapi-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03ec137fcf09f340f9ba39cf5e327340793a50055950a8300716fcc998fe4944 |
|
MD5 | fa5b85a653a7c4cd20b88901dfc6da4b |
|
BLAKE2b-256 | cba760b4b4087a62e74eed29d021e7d99db1c15d83c24708cbdc8e2d0f1feea9 |