Skip to main content

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 the Query 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 the Query 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

Metadata

Release files for trefleapi 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for trefleapi 0.1.0
File Size Uploaded
trefleapi-0.1.0.tar.gz 15.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for trefleapi 0.1.0
File Interpreter ABI Platform
trefleapi-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.6 kB

Release files / trefleapi-0.1.0.tar.gz

Download URL trefleapi-0.1.0.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1cdde11592045d93277e8481ea3524f99bcda44959eb94a78cf79f0d4aece054
BLAKE2b-256 checksum
How to use checksums
cbb732836fcc620ba9be6015aba39ac88a11f4dde119d5258551d0f80568c095
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / trefleapi-0.1.0-py3-none-any.whl

Download URL trefleapi-0.1.0-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03ec137fcf09f340f9ba39cf5e327340793a50055950a8300716fcc998fe4944
BLAKE2b-256 checksum
How to use checksums
cba760b4b4087a62e74eed29d021e7d99db1c15d83c24708cbdc8e2d0f1feea9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page