# Trefle-Api
*Trefle-API* is a simple python API wrapper for the [trefle](https://trefle.io./) botanic data API
```python
>>> 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](https://trefle.io./) RESTAPI <br>
Query tags :
- `search()`
<br> description : search a query
args : __q__ # **the string to use as query**
returns : a copy of the `Query` class to allow chaining
- `retrieve()`
<br> 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_()`
<br> 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
Raw data
{
"_id": null,
"home_page": "https://github.com/overlrd/trefle",
"name": "trefleapi",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "trefle,botanical,plants,api",
"author": "Overlrd",
"author_email": "sudooverloord@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/cb/b7/32836fcc620ba9be6015aba39ac88a11f4dde119d5258551d0f80568c095/trefleapi-0.1.0.tar.gz",
"platform": null,
"description": "# Trefle-Api\n\n*Trefle-API* is a simple python API wrapper for the [trefle](https://trefle.io./) botanic data API\n\n```python\n>>> from trefle_api import TrefleAPI\n>>> Client = TrefleAPI(token=\"trefle_api_token\")\n>>> Query = Client.search(\"rose\").in_(\"plants\").filter(family=\"Rosaceae\").sort_by(slug=\"asc\")\n>>> Query.get_json()\n\"{'data': [{'id': 265580, 'common_name': 'Field rose', 'slug': 'rosa-arvensis', 'scientific_name': 'Rosa arvensis'...\"\n>>> New_Query = Query.range(year=[2000, 2010]).exclude(common_name=\"null\")\n>>> New_Query.get_models()\n\"[[Plant(id=345576, name='', slug='physaria-purpurea', common_name='Rose bladderpod', scientific_name='Physaria purpurea', year=2002,...\"\n```\n\nThis package allows you to build simple to more complex queries to fetch data from the the [trefle](https://trefle.io./) RESTAPI <br>\nQuery tags :\n - `search()`\n <br> description : search a query \n args : __q__ # **the string to use as query**\n returns : a copy of the `Query` class to allow chaining\n - `retrieve()`\n <br> description : retrieve an item based on it's slug or id \n args : __slug__ or __id__ # a string representing the slug of a vegetable or it's id in the trefle api records \n returns : a copy of the `Query` class to allow chaining\n\n- `in_()`\n <br> description : select a category in which to search or retrieve \n args __category__ # available categories are : \n - kingdoms\n - subkingdoms\n - divisions\n - divisionclasses\n - division_orders\n - families\n - genus\n - plants\n - species\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A simple wrapper for the trefle botanical RESTAPI",
"version": "0.1.0",
"project_urls": {
"Bug Reports": "https://github.com/oberlrd/trefle/issues",
"Homepage": "https://github.com/overlrd/trefle",
"Source": "https://github.com/oberlrd/trefle/"
},
"split_keywords": [
"trefle",
"botanical",
"plants",
"api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cba760b4b4087a62e74eed29d021e7d99db1c15d83c24708cbdc8e2d0f1feea9",
"md5": "fa5b85a653a7c4cd20b88901dfc6da4b",
"sha256": "03ec137fcf09f340f9ba39cf5e327340793a50055950a8300716fcc998fe4944"
},
"downloads": -1,
"filename": "trefleapi-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fa5b85a653a7c4cd20b88901dfc6da4b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 13199,
"upload_time": "2023-06-09T15:07:45",
"upload_time_iso_8601": "2023-06-09T15:07:45.227272Z",
"url": "https://files.pythonhosted.org/packages/cb/a7/60b4b4087a62e74eed29d021e7d99db1c15d83c24708cbdc8e2d0f1feea9/trefleapi-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cbb732836fcc620ba9be6015aba39ac88a11f4dde119d5258551d0f80568c095",
"md5": "cb7dc6ea2174f001773c2efd2c0ffb20",
"sha256": "1cdde11592045d93277e8481ea3524f99bcda44959eb94a78cf79f0d4aece054"
},
"downloads": -1,
"filename": "trefleapi-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "cb7dc6ea2174f001773c2efd2c0ffb20",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 15370,
"upload_time": "2023-06-09T15:07:47",
"upload_time_iso_8601": "2023-06-09T15:07:47.619860Z",
"url": "https://files.pythonhosted.org/packages/cb/b7/32836fcc620ba9be6015aba39ac88a11f4dde119d5258551d0f80568c095/trefleapi-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-09 15:07:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "overlrd",
"github_project": "trefle",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "trefleapi"
}