Skip to content

Commit

Permalink
Fix. Resolving merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushanand18 committed Jun 28, 2022
1 parent a773c41 commit 68e3cfc
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
test.py
tests.sh
.gitpod.yml
.vscode
.pytest_cache
Function_Changes.md
EXAMPLES.md
Function_Changes.md
.vscode
19 changes: 12 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pyobis
Python client for the `OBIS API
<https://api.obis.org/>`__.

`Source on GitHub at iobis/pyobis <https://github.com/iobis/pyobis>`__
`Source Code here <https://github.com/iobis/pyobis>`__

Other OBIS clients:

Expand All @@ -28,7 +28,7 @@ dev version
pip install git+git://github.com/sckott/pyobis.git#egg=pyobis
library API
Library API
===========

`pyobis` is split up into modules for each of the groups of API methods.
Expand All @@ -39,6 +39,11 @@ library API
* `nodes` - Nodes
* `checklist` - Checklist



Usage
===========

You can import the entire library, or each module individually as needed.

Taxa module
Expand Down Expand Up @@ -83,7 +88,7 @@ Dataset module
from pyobis import dataset
dataset.search(scientificname = ['Mola', 'Abra', 'Lanice', 'Pectinaria'])
dataset.get(id = 'ec9df3b9-3b2b-4d83-881b-27bcbcd57b95')
dataset.get(id = 2126)
Nodes module
===========
Expand All @@ -104,7 +109,7 @@ Checklist module
Meta
====

* License: MIT, see `LICENSE file <LICENSE>`__
* License: MIT, `see LICENSE file <LICENSE>`__
* Please note that this project is released with a `Contributor Code of Conduct <CONDUCT.md>`__. By participating in this project you agree to abide by its terms.

.. |pypi| image:: https://img.shields.io/pypi/v/pyobis.svg
Expand All @@ -113,8 +118,8 @@ Meta
.. |docs| image:: https://readthedocs.org/projects/pyobis/badge/?version=latest
:target: http://pyobis.readthedocs.org/en/latest/?badge=latest

.. |tests| image:: https://github.com/ayushanand18/pyobis/actions/workflows/tests.yml/badge.svg
:target: https://github.com/ayushanand18/pyobis/actions/workflows/tests.yml
.. |tests| image:: https://github.com/iobis/pyobis/actions/workflows/tests.yml/badge.svg
:target: https://github.com/iobis/pyobis/actions/workflows/tests.yml

.. |coverage| image:: https://coveralls.io/repos/sckott/pyobis/badge.svg?branch=master&service=github
:target: https://coveralls.io/github/sckott/pyobis?branch=gsoc2022
:target: https://coveralls.io/github/sckott/pyobis?branch=master
6 changes: 5 additions & 1 deletion pyobis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
'''
pyobis library
~~~~~~~~~~~~~~~~~~~~~
pyobis is a Python client for OBIS.
Example usage:
# Import entire library
import pyobis
# or import modules as needed
Expand All @@ -18,6 +21,7 @@
from pyobis import dataset
## checklist
from pyobis import checklist
## use advanced logging
### setup first
import requests
Expand All @@ -40,7 +44,7 @@
__license__ = 'MIT'

from .occurrences import search, get, grid, getpoints, point, tile, centroid, download, ObisDownload
from .taxa import search, taxon, annotations
from .taxa import search, taxon, annotations, common, taxon_search
from .nodes import search, activities
from .dataset import get, search
from .checklist import list, redlist, newest
51 changes: 47 additions & 4 deletions pyobis/taxa/taxa.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def search(scientificname=None, **kwargs):
Get taxon records.
:param scientificname: [String,Array] One or more scientific names from the OBIS backbone. All included and synonym taxa
are included in the search.
:return: A dictionary
Usage::
Expand Down Expand Up @@ -41,18 +41,61 @@ def taxon(id, **kwargs):
out = obis_GET(url, {}, 'application/json; charset=utf-8', **kwargs)
return out

def annotations(scientificname=None, **kwargs):
def annotations(scientificname, **kwargs):
'''
Get scientific name annotations by the WoRMS team.
:param scientificname: [String] Scientific name. Leave empty to include all taxa.
:return: A dictionary
Usage::
from pyobis import taxa
taxa.annotations('Abra')
taxa.annotations(Abra)
'''
url = obis_baseurl + 'taxon/annotations'
scientificname = handle_arrstr(scientificname)
out = obis_GET(url, {'scientificname':scientificname}, 'application/json; charset=utf-8', **kwargs)
return out

def taxon_search(scientificname=None, aphiaid=None, obisid=None, **kwargs):
'''
This function has become obsolete.
:param id: [Fixnum] An OBIS taxon identifier
:return: A dictionary
Usage::
from pyobis import taxa
taxa.taxon_search(scientificname = 'Mola mola')
taxa.taxon_search(scientificname = 'Mola')
taxa.taxon_search(aphiaid = 127405)
taxa.taxon_search(obisid = 472375)
'''
url = obis_baseurl + 'taxon/' + handle_arrstr(scientificname)
out = obis_GET(url, {'aphiaid': aphiaid, 'obisid': obisid,
'scientificname': scientificname}, 'application/json; charset=utf-8', **kwargs)
return out

def common(id, **kwargs):
'''
This function has become obsolete.
Get common names for a taxon by ID
:param id: [Fixnum] An OBIS taxon identifier. Required
:return: A dictionary
Usage::
from pyobis import taxa
# have common names
taxa.common(402913)
taxa.common(406296)
# no common names
taxa.common(415282)
'''
url = obis_baseurl + 'taxon/' + str(id) + '/common'
out = obis_GET(url, {}, 'application/json; charset=utf-8', **kwargs)
return out

0 comments on commit 68e3cfc

Please sign in to comment.