Skip to content

Latest commit

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

eol_python

A Python 3 wrapper for the Encyclopedia of Life API.

Installation

Clone this repo and import eol_api_wrapper.py as a module:

>>>importeol_api_wrapperaseol

Usage

To 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

About

A wrapper for the Encyclopedia of Life API, in Python

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages