ebird-api 3.0.6__tar.gz → 3.0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ebird-api-3.0.6 → ebird_api-3.0.7}/CHANGELOG.md +5 -0
- {ebird-api-3.0.6 → ebird_api-3.0.7}/LICENSE.txt +1 -1
- {ebird-api-3.0.6 → ebird_api-3.0.7}/MANIFEST.in +1 -1
- ebird_api-3.0.7/PKG-INFO +321 -0
- {ebird-api-3.0.6 → ebird_api-3.0.7}/README.md +4 -6
- ebird_api-3.0.7/pyproject.toml +56 -0
- {ebird-api-3.0.6 → ebird_api-3.0.7}/setup.cfg +0 -3
- ebird_api-3.0.7/setup.py +3 -0
- {ebird-api-3.0.6 → ebird_api-3.0.7/src}/ebird/api/__init__.py +13 -36
- {ebird-api-3.0.6 → ebird_api-3.0.7/src}/ebird/api/checklists.py +13 -9
- {ebird-api-3.0.6 → ebird_api-3.0.7/src}/ebird/api/client.py +105 -44
- ebird_api-3.0.7/src/ebird/api/constants.py +101 -0
- {ebird-api-3.0.6 → ebird_api-3.0.7/src}/ebird/api/hotspots.py +21 -18
- {ebird-api-3.0.6 → ebird_api-3.0.7/src}/ebird/api/observations.py +189 -111
- {ebird-api-3.0.6 → ebird_api-3.0.7/src}/ebird/api/regions.py +12 -11
- {ebird-api-3.0.6 → ebird_api-3.0.7/src}/ebird/api/statistics.py +20 -16
- {ebird-api-3.0.6 → ebird_api-3.0.7/src}/ebird/api/taxonomy.py +22 -21
- {ebird-api-3.0.6 → ebird_api-3.0.7/src}/ebird/api/utils.py +23 -24
- {ebird-api-3.0.6 → ebird_api-3.0.7/src}/ebird/api/validation.py +81 -62
- ebird_api-3.0.7/src/ebird_api.egg-info/PKG-INFO +321 -0
- ebird_api-3.0.7/src/ebird_api.egg-info/SOURCES.txt +21 -0
- ebird-api-3.0.6/PKG-INFO +0 -319
- ebird-api-3.0.6/ebird/api/constants.py +0 -93
- ebird-api-3.0.6/ebird_api.egg-info/PKG-INFO +0 -319
- ebird-api-3.0.6/ebird_api.egg-info/SOURCES.txt +0 -21
- ebird-api-3.0.6/setup.py +0 -51
- {ebird-api-3.0.6 → ebird_api-3.0.7/src}/ebird_api.egg-info/dependency_links.txt +0 -0
- {ebird-api-3.0.6 → ebird_api-3.0.7/src}/ebird_api.egg-info/top_level.txt +0 -0
|
@@ -8,6 +8,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|
|
8
8
|
This project adheres to [PEP440](https://www.python.org/dev/peps/pep-0440/)
|
|
9
9
|
and by implication, [Semantic Versioning](http://semver.org/).
|
|
10
10
|
|
|
11
|
+
## [3.0.7] - 2024-10-09
|
|
12
|
+
### Changed
|
|
13
|
+
- get_taxonomy now passes "locale" as a parameter, not "sppLocale",
|
|
14
|
+
which was ignored so all names were returned in English.
|
|
15
|
+
|
|
11
16
|
## [3.0.6] - 2020-09-09
|
|
12
17
|
### Changed
|
|
13
18
|
- Subnational1 and subnational2 codes were assumed to be at least two
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
include CHANGELOG.md LICENSE.txt
|
|
2
|
-
recursive-include
|
|
2
|
+
recursive-include src *.py
|
ebird_api-3.0.7/PKG-INFO
ADDED
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: ebird-api
|
|
3
|
+
Version: 3.0.7
|
|
4
|
+
Summary: Wrapper for accessing the eBird API
|
|
5
|
+
Author-email: Project Babbler <projectbabbler@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
Project-URL: Repository, https://github.com/ProjectBabbler/ebird-api.git
|
|
8
|
+
Project-URL: Issues, https://github.com/ProjectBabbler/ebird-api/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/ProjectBabbler/ebird-api/blob/master/CHANGELOG.md
|
|
10
|
+
Keywords: eBird,API,client
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
24
|
+
Classifier: Natural Language :: English
|
|
25
|
+
Classifier: Topic :: Utilities
|
|
26
|
+
Classifier: Topic :: Internet
|
|
27
|
+
Requires-Python: >=3.8
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE.txt
|
|
30
|
+
|
|
31
|
+
[](https://travis-ci.org/ProjectBabbler/ebird-api)
|
|
32
|
+
[](https://badge.fury.io/py/ebird-api)
|
|
33
|
+
[](https://img.shields.io/pypi/pyversions/ebird-api)
|
|
34
|
+
|
|
35
|
+
# eBird API
|
|
36
|
+
|
|
37
|
+
eBird API provides a set of wrapper functions for accessing the end-points
|
|
38
|
+
in the eBird API 2.0.
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
pip install ebird-api
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
Each of the functions map to a specific end-point in the API - with one or
|
|
49
|
+
two exceptions where API calls are essentially identical. The functions can
|
|
50
|
+
be grouped into five activities: fetching observations, getting information
|
|
51
|
+
on hotspots, getting information on regions, getting lists of species and
|
|
52
|
+
getting statistics.
|
|
53
|
+
|
|
54
|
+
All functions support arguments (with sensible defaults) for all the query
|
|
55
|
+
parameters supported by the eBird API. Check the docstring for each function
|
|
56
|
+
for more details. There you will also find a link to the documentation for
|
|
57
|
+
each end-point.
|
|
58
|
+
|
|
59
|
+
To use the API you will need to register for an API key. All you need to do is
|
|
60
|
+
fill out this [form](https://ebird.org/api/keygen) and the API key is generated
|
|
61
|
+
automatically.
|
|
62
|
+
|
|
63
|
+
NOTE: Use the API with some restraint. Data costs money so don't go downloading
|
|
64
|
+
all the checklists for the world or other excessive behaviour or your account will
|
|
65
|
+
get banned. If you have a project in mind get in touch with eBird and tell them
|
|
66
|
+
what you want to do - they will be interested to hear it.
|
|
67
|
+
|
|
68
|
+
### Observations
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from ebird.api import get_observations
|
|
72
|
+
|
|
73
|
+
# Get observations from Woodman Pond, Madison county, New York for the past week.
|
|
74
|
+
records = get_observations(api_key, 'L227544', back=7)
|
|
75
|
+
|
|
76
|
+
# Get observations from Madison county, New York
|
|
77
|
+
records = get_observations(api_key, 'US-NY-053')
|
|
78
|
+
|
|
79
|
+
# Get observations from New York
|
|
80
|
+
records = get_observations(api_key, 'US-NY')
|
|
81
|
+
|
|
82
|
+
# Get observations from the USA - don't overdo the data downloads
|
|
83
|
+
records = get_observations(api_key, 'US')
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Any where you pass in single location or region you can also pass in a
|
|
87
|
+
list or a comma-separated string. You can specify up to 10 locations or
|
|
88
|
+
regions:
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from ebird.api import get_observations
|
|
92
|
+
|
|
93
|
+
# Get the observations for the most visited locations in Madison county, New York:
|
|
94
|
+
# Woodman Pond, Ditch Bank Rd., Cornell Biological Field Station and
|
|
95
|
+
# Anne V Pickard Memorial Wildlife Overlook.
|
|
96
|
+
locations = ['L227544', 'L273783', 'L677871', 'L2313391']
|
|
97
|
+
get_observations(api_key, locations, provisional=True, detail='full')
|
|
98
|
+
|
|
99
|
+
# Get the observations for Suffolk, Nassau and Queens counties in New York state.
|
|
100
|
+
counties = 'US-NY-103,US-NY-059,US-NY-81'
|
|
101
|
+
records = get_observations(api_key, locations, hotspot=False, category='species')
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The common name for species can be returned in different languages by specifying locale in the functions that return observations, checklists or taxonomy:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from ebird.api import get_observations
|
|
108
|
+
|
|
109
|
+
records = get_observations(api_key, 'CA-QC', locale='fr')
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
In addition to getting all the observations for a given location or in
|
|
113
|
+
an area you can also get the latest observation of each species in a
|
|
114
|
+
geographical area - useful for finding the nearest place to see a given
|
|
115
|
+
species:
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
from ebird.api import get_nearby_observations
|
|
119
|
+
|
|
120
|
+
# Get the most recent sightings of all species seen in the last week within
|
|
121
|
+
# 10km of Point Reyes National Seashore.
|
|
122
|
+
records = get_nearby_observations(api_key, 38.05, -122.94, dist=10, back=7)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The calls to get_observations() and get_nearby_observation() return all the
|
|
126
|
+
available records. You can limit the set of records returned to only include
|
|
127
|
+
notable ones (locally or nationally rare species) or limit the records to
|
|
128
|
+
a small number of species:
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
from ebird.api import get_notable_observations, get_nearby_notable, \
|
|
132
|
+
get_species_observations, get_nearby_species
|
|
133
|
+
|
|
134
|
+
# Get the interesting birds seen in New York state.
|
|
135
|
+
records = get_notable_observations(api_key, 'US-NY')
|
|
136
|
+
|
|
137
|
+
# Get the observations of Horned Lark (Eremophila alpestris) in New York state.
|
|
138
|
+
records = get_species_observations(api_key, 'horlar', 'US-NY')
|
|
139
|
+
|
|
140
|
+
# Get the interesting birds within 50kn of Point Reyes
|
|
141
|
+
records = get_nearby_notable(api_key, 38.05, -122.94, dist=50)
|
|
142
|
+
|
|
143
|
+
# Find out if Barn Swallows have been seen in the area in the past 10 days
|
|
144
|
+
records = get_nearby_species(api_key, 'barswa', 38.05, -122.94, back=10)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
For the more travel-minded you can also find out the nearest place to see a given species:
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from ebird.api import get_nearest_species
|
|
151
|
+
|
|
152
|
+
# Where is the closest place to Cornell Lab of Ornithology to see
|
|
153
|
+
# Tennessee Warbler.
|
|
154
|
+
locations = get_nearest_species('tenwar', 42.48, -76.45)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Depending on what time of year you try this, you might have a long way to go.
|
|
158
|
+
|
|
159
|
+
### Checklists
|
|
160
|
+
|
|
161
|
+
There are two functions for finding out what has been seen at a given location.
|
|
162
|
+
First you can get the list of checklists for a given country, region or location
|
|
163
|
+
using get_visits(). Each result returned has the unique identifier for the
|
|
164
|
+
checklist. You can then call get_checklist() to get the list of observations.
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
from ebird.api import get_visits, get_checklist
|
|
168
|
+
|
|
169
|
+
# Get visits made recently to locations in New York state:
|
|
170
|
+
records = get_visits(api_key, 'US-NY')
|
|
171
|
+
|
|
172
|
+
# Get visits made recently to locations in New York state on Jan 1st 2010
|
|
173
|
+
records = get_visits(api_key, 'US-NY', '2010-01-01')
|
|
174
|
+
|
|
175
|
+
# Get the details of a checklist
|
|
176
|
+
checklist = get_checklist(api_key, 'S22536787')
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Hotspots
|
|
180
|
+
|
|
181
|
+
There are two functions for discovering hotspots. get_hotspots() list all
|
|
182
|
+
the locations in a given area. You can find all the hotspots visited recently
|
|
183
|
+
by given a value for the back argument. get_nearby_hotspots() is used to find
|
|
184
|
+
hotspots within a given radius. get_hotspot() can be used to get information
|
|
185
|
+
on the location of a given hotspot.
|
|
186
|
+
|
|
187
|
+
```python
|
|
188
|
+
from ebird.api import get_hotspots, get_nearby_hotspots, get_hotspot
|
|
189
|
+
|
|
190
|
+
# List all the hotspots in New York state.
|
|
191
|
+
hotspots = get_hotspots(api_key, 'US-NY')
|
|
192
|
+
|
|
193
|
+
# List all the hotspots in New York state visited in the past week.
|
|
194
|
+
recent = get_hotspots(api_key, 'US-NY', back=7)
|
|
195
|
+
|
|
196
|
+
# List all the hotspots in New York state visited in the past week.
|
|
197
|
+
recent = get_hotspots(api_key, 'US-NY', back=7)
|
|
198
|
+
|
|
199
|
+
# List all the hotspots in within 50kn of Point Reyes
|
|
200
|
+
nearby = get_nearby_hotspots(api_key, 38.05, -122.94, dist=50)
|
|
201
|
+
|
|
202
|
+
# Get the details of Anne V Pickard Memorial Wildlife Overlook in New York state.
|
|
203
|
+
details = get_hotspot(api_key, 'L2313391')
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Regions
|
|
207
|
+
|
|
208
|
+
eBird divides the world into countries, subnational1 regions (states) or
|
|
209
|
+
subnational2 regions (counties). You can use get_regions() to get the
|
|
210
|
+
list of sub-regions for a given region. For the approximate area covered
|
|
211
|
+
by a region use get_region().
|
|
212
|
+
|
|
213
|
+
```python
|
|
214
|
+
from ebird.api import get_regions, get_adjacent_regions, get_region
|
|
215
|
+
|
|
216
|
+
# Get the list of countries in the world.
|
|
217
|
+
countries = get_regions(api_key, 'country', 'world')
|
|
218
|
+
|
|
219
|
+
# Get the list of states in the US.
|
|
220
|
+
states = get_regions(api_key, 'subnational1', 'US')
|
|
221
|
+
|
|
222
|
+
# Get the list of counties in New York state.
|
|
223
|
+
counties = get_regions(api_key, 'subnational2', 'US-NY')
|
|
224
|
+
|
|
225
|
+
# Get the list of states which border New York state.
|
|
226
|
+
nearby = get_adjacent_regions(api_key, 'US-NY')
|
|
227
|
+
|
|
228
|
+
# Get the approximate area covered by New York state.
|
|
229
|
+
bounds = get_region(api_key, 'US-NY')
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Taxonomy
|
|
233
|
+
|
|
234
|
+
You can get details of all the species, subspecies, forms
|
|
235
|
+
etc. in the taxonomy used by eBird. It's the easiest way
|
|
236
|
+
of getting the codes for each species or subspecies,
|
|
237
|
+
e.g. horlar (Horned Lark), cangoo (Canada Goose), etc.,
|
|
238
|
+
that are used in the other API calls.
|
|
239
|
+
|
|
240
|
+
```python
|
|
241
|
+
from ebird.api import get_taxonomy, get_taxonomy_forms, get_taxonomy_versions
|
|
242
|
+
|
|
243
|
+
# Get all the species in the eBird taxonomy.
|
|
244
|
+
taxonomy = get_taxonomy(api_key)
|
|
245
|
+
|
|
246
|
+
# Get all the species in the eBird taxonomy with common names in Spanish
|
|
247
|
+
names = get_taxonomy(api_key, locale='es')
|
|
248
|
+
|
|
249
|
+
# Get all the taxonomy for Horned Lark
|
|
250
|
+
species = get_taxonomy(api_key, species='horlar')
|
|
251
|
+
|
|
252
|
+
# Get the codes for all the subspecies and froms recognised for Barn Swallow.
|
|
253
|
+
forms = get_taxonomy_forms(api_key, 'barswa')
|
|
254
|
+
|
|
255
|
+
# Get information on all the taxonomy revisions, i.e. versions.
|
|
256
|
+
# Usually only the latest is important.
|
|
257
|
+
versions = get_taxonomy_versions(api_key)
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Statistics
|
|
261
|
+
|
|
262
|
+
You can also get some statistics from the eBird data. The most interesting
|
|
263
|
+
is probably get_top_100() which returns the list of observers who have seen
|
|
264
|
+
the most species or submitted the largest number of checklists. The list is
|
|
265
|
+
just for a specific day so it is really only useful for "Big Days" when
|
|
266
|
+
lots of people are out trying to get the greatest number of species.
|
|
267
|
+
|
|
268
|
+
```python
|
|
269
|
+
from datetime import date
|
|
270
|
+
from ebird.api import get_top_100, get_totals
|
|
271
|
+
|
|
272
|
+
# Get the winner of the Global Big Day in New York, on 5th May 2018
|
|
273
|
+
winners = get_top_100(api_key, 'US-NY', '2018-05-05')
|
|
274
|
+
|
|
275
|
+
# Get the number of contributors, checklist submitted and species seen today
|
|
276
|
+
totals = get_totals(api_key, 'US-NY', date.today())
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Client
|
|
280
|
+
|
|
281
|
+
There is a simple Client class which wraps the various functions from the API.
|
|
282
|
+
You can set the API key and locale when creating a Client instance so you don't
|
|
283
|
+
have to keep passing them as arguments.
|
|
284
|
+
|
|
285
|
+
```python
|
|
286
|
+
from ebird.api import Client
|
|
287
|
+
|
|
288
|
+
api_key = 'abc123'
|
|
289
|
+
locale = 'es'
|
|
290
|
+
|
|
291
|
+
client = Client(api_key, locale)
|
|
292
|
+
|
|
293
|
+
client.get_observations('MX-OAX')
|
|
294
|
+
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
The client supports all the API functions.
|
|
298
|
+
|
|
299
|
+
## Formats
|
|
300
|
+
|
|
301
|
+
Most of the eBird API calls return JSON. Some of the calls such as getting
|
|
302
|
+
the hotspots for a region or getting the taxonomy also support CSV. Since
|
|
303
|
+
converting JSON to CSV is simple this library is opinionated in that it
|
|
304
|
+
only returns JSON.
|
|
305
|
+
|
|
306
|
+
## Compatibility
|
|
307
|
+
|
|
308
|
+
ebird-api works with Python 3.5+.
|
|
309
|
+
|
|
310
|
+
## Links
|
|
311
|
+
|
|
312
|
+
Documentation for the eBird API: https://documenter.getpostman.com/view/664302/S1ENwy59?version=latest#intro
|
|
313
|
+
though it could do with a little love and attention.
|
|
314
|
+
|
|
315
|
+
Available translations for species names: http://help.ebird.org/customer/portal/articles/1596582
|
|
316
|
+
|
|
317
|
+
Information on the taxonomy used by eBird: http://help.ebird.org/customer/portal/articles/1006825-the-ebird-taxonomy
|
|
318
|
+
|
|
319
|
+
## License
|
|
320
|
+
|
|
321
|
+
eBird API is available under the terms of the [MIT](https://opensource.org/licenses/MIT) licence.
|
|
@@ -71,8 +71,7 @@ counties = 'US-NY-103,US-NY-059,US-NY-81'
|
|
|
71
71
|
records = get_observations(api_key, locations, hotspot=False, category='species')
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
The functions that return observations, checklists or taxonomy
|
|
75
|
-
the common name for species to be returned in different languages:
|
|
74
|
+
The common name for species can be returned in different languages by specifying locale in the functions that return observations, checklists or taxonomy:
|
|
76
75
|
|
|
77
76
|
```python
|
|
78
77
|
from ebird.api import get_observations
|
|
@@ -115,8 +114,7 @@ records = get_nearby_notable(api_key, 38.05, -122.94, dist=50)
|
|
|
115
114
|
records = get_nearby_species(api_key, 'barswa', 38.05, -122.94, back=10)
|
|
116
115
|
```
|
|
117
116
|
|
|
118
|
-
For the more travel-minded you can also find out
|
|
119
|
-
to see a given species:
|
|
117
|
+
For the more travel-minded you can also find out the nearest place to see a given species:
|
|
120
118
|
|
|
121
119
|
```python
|
|
122
120
|
from ebird.api import get_nearest_species
|
|
@@ -207,7 +205,7 @@ You can get details of all the species, subspecies, forms
|
|
|
207
205
|
etc. in the taxonomy used by eBird. It's the easiest way
|
|
208
206
|
of getting the codes for each species or subspecies,
|
|
209
207
|
e.g. horlar (Horned Lark), cangoo (Canada Goose), etc.,
|
|
210
|
-
that are used in the other API calls.
|
|
208
|
+
that are used in the other API calls.
|
|
211
209
|
|
|
212
210
|
```python
|
|
213
211
|
from ebird.api import get_taxonomy, get_taxonomy_forms, get_taxonomy_versions
|
|
@@ -232,7 +230,7 @@ versions = get_taxonomy_versions(api_key)
|
|
|
232
230
|
### Statistics
|
|
233
231
|
|
|
234
232
|
You can also get some statistics from the eBird data. The most interesting
|
|
235
|
-
is probably get_top_100() which
|
|
233
|
+
is probably get_top_100() which returns the list of observers who have seen
|
|
236
234
|
the most species or submitted the largest number of checklists. The list is
|
|
237
235
|
just for a specific day so it is really only useful for "Big Days" when
|
|
238
236
|
lots of people are out trying to get the greatest number of species.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
build-backend = "setuptools.build_meta"
|
|
3
|
+
requires = ["setuptools >= 61.0"]
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
authors = [
|
|
7
|
+
{name = "Project Babbler", email = "projectbabbler@gmail.com"},
|
|
8
|
+
]
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Development Status :: 5 - Production/Stable",
|
|
11
|
+
"Environment :: Console",
|
|
12
|
+
"Intended Audience :: Science/Research",
|
|
13
|
+
"License :: OSI Approved :: MIT License",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
15
|
+
"Programming Language :: Python",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.8",
|
|
18
|
+
"Programming Language :: Python :: 3.9",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
23
|
+
"Natural Language :: English",
|
|
24
|
+
"Topic :: Utilities",
|
|
25
|
+
"Topic :: Internet",
|
|
26
|
+
]
|
|
27
|
+
description = 'Wrapper for accessing the eBird API'
|
|
28
|
+
keywords = ["eBird", "API", "client"]
|
|
29
|
+
license = {text = "MIT License"}
|
|
30
|
+
name = "ebird-api"
|
|
31
|
+
readme = "README.md"
|
|
32
|
+
requires-python = ">= 3.8"
|
|
33
|
+
version = "3.0.7"
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Repository = "https://github.com/ProjectBabbler/ebird-api.git"
|
|
37
|
+
Issues = "https://github.com/ProjectBabbler/ebird-api/issues"
|
|
38
|
+
Changelog = "https://github.com/ProjectBabbler/ebird-api/blob/master/CHANGELOG.md"
|
|
39
|
+
|
|
40
|
+
[tool.black]
|
|
41
|
+
# Notes:
|
|
42
|
+
#
|
|
43
|
+
# line-length: this is just the default but it's included here so it's easy
|
|
44
|
+
# to see that the value is synced with other code quality tools.
|
|
45
|
+
#
|
|
46
|
+
# target-version: the python version is set when the project is generated
|
|
47
|
+
# so we might as well make use of it.
|
|
48
|
+
#
|
|
49
|
+
# exclude: the regex for excluding migrations is added in case you don't
|
|
50
|
+
# want them reformatted.
|
|
51
|
+
#
|
|
52
|
+
# For all options see:
|
|
53
|
+
# https://black.readthedocs.io/en/stable/installation_and_usage.html
|
|
54
|
+
|
|
55
|
+
line-length = 88
|
|
56
|
+
target-version = ["py312"]
|
ebird_api-3.0.7/setup.py
ADDED
|
@@ -2,50 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
"""A set of wrapper functions for accessing the eBird API."""
|
|
4
4
|
|
|
5
|
-
__version__ =
|
|
6
|
-
|
|
7
|
-
from ebird.api.constants import (
|
|
8
|
-
LOCALES
|
|
9
|
-
)
|
|
5
|
+
__version__ = "3.0.7"
|
|
10
6
|
|
|
7
|
+
from ebird.api.checklists import get_checklist, get_visits
|
|
8
|
+
from ebird.api.client import Client
|
|
9
|
+
from ebird.api.constants import LOCALES
|
|
10
|
+
from ebird.api.hotspots import get_hotspot, get_hotspots, get_nearby_hotspots
|
|
11
11
|
from ebird.api.observations import (
|
|
12
|
-
|
|
13
|
-
get_notable_observations,
|
|
14
|
-
get_species_observations,
|
|
15
|
-
get_nearby_observations,
|
|
12
|
+
get_historic_observations,
|
|
16
13
|
get_nearby_notable,
|
|
14
|
+
get_nearby_observations,
|
|
17
15
|
get_nearby_species,
|
|
18
16
|
get_nearest_species,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
from ebird.api.checklists import (
|
|
23
|
-
get_visits,
|
|
24
|
-
get_checklist,
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
from ebird.api.hotspots import (
|
|
28
|
-
get_hotspots,
|
|
29
|
-
get_nearby_hotspots,
|
|
30
|
-
get_hotspot,
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
from ebird.api.regions import (
|
|
34
|
-
get_regions,
|
|
35
|
-
get_region,
|
|
36
|
-
get_adjacent_regions,
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
from ebird.api.statistics import (
|
|
40
|
-
get_top_100,
|
|
41
|
-
get_totals,
|
|
17
|
+
get_notable_observations,
|
|
18
|
+
get_observations,
|
|
19
|
+
get_species_observations,
|
|
42
20
|
)
|
|
43
|
-
|
|
21
|
+
from ebird.api.regions import get_adjacent_regions, get_region, get_regions
|
|
22
|
+
from ebird.api.statistics import get_top_100, get_totals
|
|
44
23
|
from ebird.api.taxonomy import (
|
|
45
24
|
get_taxonomy,
|
|
46
25
|
get_taxonomy_forms,
|
|
47
26
|
get_taxonomy_groups,
|
|
48
|
-
get_taxonomy_versions
|
|
27
|
+
get_taxonomy_versions,
|
|
49
28
|
)
|
|
50
|
-
|
|
51
|
-
from ebird.api.client import Client
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"""Functions for fetching checklists and information about visits."""
|
|
2
2
|
|
|
3
3
|
from ebird.api.utils import call
|
|
4
|
+
from ebird.api.validation import (
|
|
5
|
+
clean_area,
|
|
6
|
+
clean_code,
|
|
7
|
+
clean_date,
|
|
8
|
+
clean_max_checklists,
|
|
9
|
+
)
|
|
4
10
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
CHECKLISTS_RECENT_URL = 'https://ebird.org/ws2.0/product/lists/%s'
|
|
9
|
-
CHECKLIST_URL = 'https://ebird.org/ws2.0/product/checklist/view/%s'
|
|
11
|
+
CHECKLISTS_DATE_URL = "https://ebird.org/ws2.0/product/lists/%s/%s"
|
|
12
|
+
CHECKLISTS_RECENT_URL = "https://ebird.org/ws2.0/product/lists/%s"
|
|
13
|
+
CHECKLIST_URL = "https://ebird.org/ws2.0/product/checklist/view/%s"
|
|
10
14
|
|
|
11
15
|
|
|
12
16
|
def get_visits(token, area, date=None, max_results=10):
|
|
@@ -51,12 +55,12 @@ def get_visits(token, area, date=None, max_results=10):
|
|
|
51
55
|
url = CHECKLISTS_RECENT_URL % clean_area(area)
|
|
52
56
|
|
|
53
57
|
params = {
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
"maxVisits": clean_max_checklists(max_results),
|
|
59
|
+
"sortKey": "obs_dt",
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
headers = {
|
|
59
|
-
|
|
63
|
+
"X-eBirdApiToken": token,
|
|
60
64
|
}
|
|
61
65
|
|
|
62
66
|
return call(url, params, headers)
|
|
@@ -91,7 +95,7 @@ def get_checklist(token, sub_id):
|
|
|
91
95
|
url = CHECKLIST_URL % clean_code(sub_id)
|
|
92
96
|
|
|
93
97
|
headers = {
|
|
94
|
-
|
|
98
|
+
"X-eBirdApiToken": token,
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
return call(url, {}, headers)
|