Giter Site home page Giter Site logo

shamrock's Introduction

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)

Methods that can be run with the API are:

api.kingdoms()
api.subkingdoms()
api.divisions()
api.division_classes()
api.division_orders()
api.families()
api.genus()
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()

You can also use the varoius query string options described on Trefle API documentation as keyword arguments in methods, however, be careful when unpacking filters, for example:

filters = {"filter[common_name]" : "blackwood"}
api.species(**filters)

shamrock's People

Contributors

dependabot[bot] avatar zmasek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

svetafo

shamrock's Issues

Query string option

So far anything goes, but maybe blacklist all and whitelist only available ones would be a better solution.

Custom exception

Add custom exception to handle the breaking of the library instead of relying on other exceptions.

Better caching of calls

Currently, the library only caches one result. Explore if lru_cache would make sense to expand this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.