
Product
Socket Now Supports pylock.toml Files
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
|pypi| |docs| |ghactions| |coverage| |black|
Python client for the GBIF API <https://www.gbif.org/developer/summary>
_
Source on GitHub at gbif/pygbif <https://github.com/gbif/pygbif>
_
Other GBIF clients:
rgbif
, ropensci/rgbif <https://github.com/ropensci/rgbif>
_gbifrb
, sckott/gbifrb <https://github.com/sckott/gbifrb>
_php-gbif
, restelae/php-gbif <https://gitlab.res-telae.cat/restelae/php-gbif>
_Contributing: CONTRIBUTING.md <https://github.com/gbif/pygbif/blob/master/.github/CONTRIBUTING.md>
_
Stable from pypi
.. code-block:: console
pip install pygbif
Development version
.. code-block:: console
[sudo] pip install git+git://github.com/gbif/pygbif.git#egg=pygbif
pygbif
is split up into modules for each of the major groups of API methods.
You can import the entire library, or each module individually as needed.
In addition there is a utils module, currently with one method: wkt_rewind
, and
a caching
method to manage whether HTTP requests are cached or not. See ?pygbif.caching
.
registry module API:
organizations
nodes
networks
installations
datasets
dataset_metrics
dataset_suggest
dataset_search
Example usage:
.. code-block:: python
from pygbif import registry
registry.dataset_metrics(uuid='3f8a1297-3259-4700-91fc-acc4170b27ce')
species module API:
name_backbone
name_suggest
name_usage
name_lookup
name_parser
Example usage:
.. code-block:: python
from pygbif import species
species.name_suggest(q='Puma concolor')
occurrences module API:
search
get
get_verbatim
get_fragment
count
count_basisofrecord
count_year
count_datasets
count_countries
count_schema
count_publishingcountries
download
download_meta
download_list
download_get
download_citation
download_describe
download_sql
Example usage:
.. code-block:: python
from pygbif import occurrences as occ
occ.search(taxonKey = 3329049)
occ.get(key = 252408386)
occ.count(isGeoreferenced = True)
occ.download('basisOfRecord = PRESERVED_SPECIMEN')
occ.download('taxonKey = 3119195')
occ.download('decimalLatitude > 50')
occ.download_list(user = "sckott", limit = 5)
occ.download_meta(key = "0000099-140929101555934")
occ.download_get("0000066-140928181241064")
occ.download_citation("0002526-241107131044228")
occ.download_describe("simpleCsv")
occ.download_sql("SELECT gbifid,countryCode FROM occurrence WHERE genusKey = 2435098")
maps module API:
map
Example usage:
.. code-block:: python
from pygbif import maps
out = maps.map(taxonKey = 212, year = 1998, bin = "hex",
hexPerTile = 30, style = "classic-noborder.poly")
out.response
out.path
out.img
out.plot()
.. image:: https://github.com/gbif/pygbif/raw/master/gbif_map.png :width: 25%
utils module API:
wkt_rewind
Example usage:
.. code-block:: python
from pygbif import utils
x = 'POLYGON((144.6 13.2, 144.6 13.6, 144.9 13.6, 144.9 13.2, 144.6 13.2))'
utils.wkt_rewind(x)
Scott Chamberlain <https://github.com/sckott>
_Robert Forkel <https://github.com/xrotwang>
_Jan Legind <https://github.com/jlegind>
_Stijn Van Hoey <https://github.com/stijnvanhoey>
_Peter Desmet <https://github.com/peterdesmet>
_Nicolas Noé <https://github.com/niconoe>
_LICENSE file <LICENSE>
_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/pygbif.svg :target: https://pypi.python.org/pypi/pygbif
.. |docs| image:: https://readthedocs.org/projects/pygbif/badge/?version=latest :target: http://pygbif.rtfd.org/
.. |ghactions| image:: https://github.com/gbif/pygbif/workflows/Python/badge.svg :target: https://github.com/gbif/pygbif/actions?query=workflow%3APython
.. |coverage| image:: https://codecov.io/gh/gbif/pygbif/branch/master/graph/badge.svg?token=frXPREGk1D :target: https://codecov.io/gh/gbif/pygbif
.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/black
occurrences.download_citation
158
occurrences.download_sql
157
occurrences.download_describe
142
literature.search
149
138
, 129
101
, 128
remove_expired_responses
method is deprecated. 126
isNull
, isNotNull
, in
and not
92
, 102
and 103
104
add_predicate
function and added add_pred_dict
to accomodate for newly supported predicates to ensure that the arguments that are sent are added in the payload function 108
105
107
106
95
and 99
93
occurrences.download
when giving geometry
as a string rather than using add_geometry
; predicates were being split on whitespace, which doesn't work for WKT 81
84
logging
module instead of print()
for giving information on occurrence download methods 78
occurrences.count
for length 1 inputs only; see occurrences.search
for > 1 value 75
77
species.name_usage
method, mostly for the language
parameter 68
download_cancel
for cancelling/deleting a download request 59
occurrences.search
now supports recordedByID
and identifiedByID
search parameters 62
64
65
is
and ==
, was using them inappropriately sometimes (via https://realpython.com/python-is-identity-vs-equality/), 69
71
gbif_GET_write
more general to avoid errors if GBIF changes content type response header slightly 72
?pygbif.caching
for all the details 52
56
via @nleguillarmespecies.name_backbone
is likely what you want 55
thanks @qgroombool
, convert them to lowercase strings internally before doing HTTP requests19
41
49
wkt_rewind
46
thanks @aubreymoore for the inspirationidentifierTyp
instead of identifierType
48
thanks @data-biodiversity-aq47
25
16
27
thanks @jlegind @stijnvanhoey @peterdesmet !geometry
parameter 35
occurrences.get
, and occurrences.get_verbatim
, occurrences.get_fragment
and demo that used occurrence keys that no longer exist in GBIF 39
organizations
method to registry
module 12
registry.dataset_search
(including faceting support 37
) and registry.dataset_suggest
, for the /dataset/search
and /dataset/suggest
routes, respectively 40
species.name_lookup
(including faceting support 38
) and species.name_usage
, for the /species/search
and /species
routes, respectively 18
species.name_suggest
to give back data stucture as received from GBIF. We used to parse out the classification data, but for simplicity and speed, that is left up to the user now.start
parameter in species.name_suggest
, occurrences.download_list
, registry.organizations
, registry.nodes
, registry.networks
, and registry.installations
, changed to offset
to match GBIF API and match usage throughout remainder of pygbif
occurrence.search
parameters, including repatriated
, kingdomKey
, phylumKey
, classKey
, orderKey
, familyKey
, genusKey
, subgenusKey
, establishmentMeans
, facet
, facetMincount
, facetMultiselect
, and support for facet paging via **kwargs
30
34
**kwargs
in occurrence.search
so that facet parameters can be parsed correctly and requests
GET request options are collected correctly 36
spellCheck
parameter to occurrence.search
that goes along with the q
parameter to optionally spell check full text searches 31
limit
value to 300 for occurrences.search
methodtox
now included, via @xrotwang 20
11
16
18
requests
and pygbif
versions 13
occurrences.download_get
23
occurrences.get
22
10
FAQs
Python client for GBIF
We found that pygbif demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.
Research
Security News
Malicious Ruby gems typosquat Fastlane plugins to steal Telegram bot tokens, messages, and files, exploiting demand after Vietnam’s Telegram ban.