A Python 3 wrapper for the Encyclopedia of Life API.
Clone this repo and import eol_api_wrapper.py as a module:
>>> import eol_api_wrapper as eolTo start accessing the API, first instantiate an instance of the API class. If you intend to make a lot of calls to the API, generate an API key as described here and add as an argument:
>>> api = eol.API(key= 12345)Check whether you can ping the api:
>>> api.ping()
#'Success'You now have access to the EOL API methods Page, Search, Collections, DataObjects and HierachyEntries from within the api object:
>>> page = api.Page(1045608)
>>> page.scientific_name #returned variables are stored as object attributes
#'Apis mellifera Linnaeus 1758'Each method returns a JSON object. Specific method arguments can be adjusted using **kwargs.
The Search method comes with an added optional "all" argument that returns all the pages for a particular search string.
>>> marchantia = api.Search("Marchantia",page = "all")
>>> marchantia.total_results
#167
>>> len(marchantia.results)
#167