ebird-api 3.0.7__tar.gz → 3.1.1__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.7 → ebird_api-3.1.1}/CHANGELOG.md +27 -18
- {ebird_api-3.0.7/src/ebird_api.egg-info → ebird_api-3.1.1}/PKG-INFO +72 -19
- {ebird_api-3.0.7 → ebird_api-3.1.1}/README.md +71 -18
- ebird_api-3.1.1/pyproject.toml +127 -0
- {ebird_api-3.0.7 → ebird_api-3.1.1}/src/ebird/api/__init__.py +2 -1
- {ebird_api-3.0.7 → ebird_api-3.1.1}/src/ebird/api/checklists.py +3 -3
- {ebird_api-3.0.7 → ebird_api-3.1.1}/src/ebird/api/client.py +8 -1
- {ebird_api-3.0.7 → ebird_api-3.1.1}/src/ebird/api/hotspots.py +4 -4
- {ebird_api-3.0.7 → ebird_api-3.1.1}/src/ebird/api/observations.py +8 -8
- {ebird_api-3.0.7 → ebird_api-3.1.1}/src/ebird/api/regions.py +3 -3
- {ebird_api-3.0.7 → ebird_api-3.1.1}/src/ebird/api/statistics.py +2 -2
- {ebird_api-3.0.7 → ebird_api-3.1.1}/src/ebird/api/taxonomy.py +35 -4
- {ebird_api-3.0.7 → ebird_api-3.1.1/src/ebird_api.egg-info}/PKG-INFO +72 -19
- {ebird_api-3.0.7 → ebird_api-3.1.1}/src/ebird_api.egg-info/SOURCES.txt +0 -1
- ebird_api-3.0.7/MANIFEST.in +0 -2
- ebird_api-3.0.7/pyproject.toml +0 -56
- {ebird_api-3.0.7 → ebird_api-3.1.1}/LICENSE.txt +0 -0
- {ebird_api-3.0.7 → ebird_api-3.1.1}/setup.cfg +0 -0
- {ebird_api-3.0.7 → ebird_api-3.1.1}/setup.py +0 -0
- {ebird_api-3.0.7 → ebird_api-3.1.1}/src/ebird/api/constants.py +0 -0
- {ebird_api-3.0.7 → ebird_api-3.1.1}/src/ebird/api/utils.py +0 -0
- {ebird_api-3.0.7 → ebird_api-3.1.1}/src/ebird/api/validation.py +0 -0
- {ebird_api-3.0.7 → ebird_api-3.1.1}/src/ebird_api.egg-info/dependency_links.txt +0 -0
- {ebird_api-3.0.7 → ebird_api-3.1.1}/src/ebird_api.egg-info/top_level.txt +0 -0
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
|
-
Only changes for the API functions are described here. Changes made
|
|
4
|
-
to the internals and developing the package are not included. Check
|
|
3
|
+
Only changes for the API functions are described here. Changes made
|
|
4
|
+
to the internals and developing the package are not included. Check
|
|
5
5
|
the git log for details.
|
|
6
6
|
|
|
7
7
|
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.1.1] - 2024-12-30
|
|
12
|
+
## Changed
|
|
13
|
+
- URLs calling the api are now in the form, https://api.ebird.org/v2/...
|
|
14
|
+
|
|
15
|
+
## [3.1.0] - 2024-12-30
|
|
16
|
+
### Added
|
|
17
|
+
- get_taxonomy_locales which returns a list of all the languages
|
|
18
|
+
supported for species common names.
|
|
19
|
+
|
|
11
20
|
## [3.0.7] - 2024-10-09
|
|
12
21
|
### Changed
|
|
13
22
|
- get_taxonomy now passes "locale" as a parameter, not "sppLocale",
|
|
@@ -16,40 +25,40 @@ and by implication, [Semantic Versioning](http://semver.org/).
|
|
|
16
25
|
## [3.0.6] - 2020-09-09
|
|
17
26
|
### Changed
|
|
18
27
|
- Subnational1 and subnational2 codes were assumed to be at least two
|
|
19
|
-
characters. Now they are at least 1 character.
|
|
28
|
+
characters. Now they are at least 1 character.
|
|
20
29
|
|
|
21
30
|
## [3.0.5] - 2019-08-31
|
|
22
31
|
### Changed
|
|
23
|
-
- Replaced the checklistSort query parameter for the top_100 end-point
|
|
32
|
+
- Replaced the checklistSort query parameter for the top_100 end-point
|
|
24
33
|
with rankedBy. This change was made by eBird as checklistSort was not
|
|
25
34
|
working.
|
|
26
35
|
|
|
27
36
|
## [3.0.4] - 2019-07-22
|
|
28
37
|
### Changed
|
|
29
|
-
- Update the functions for fetching observations to use the sppLocale
|
|
38
|
+
- Update the functions for fetching observations to use the sppLocale
|
|
30
39
|
query parameter to match the recent changes made in the eBird API.
|
|
31
40
|
|
|
32
41
|
## [3.0.3] - 2019-07-16
|
|
33
42
|
### Changed
|
|
34
43
|
- When fetching observations, the list of area may only contain 10 items.
|
|
35
|
-
Previously more than 10 were allowed but this was a bug and was fixed to
|
|
36
|
-
limit the load on the server.
|
|
44
|
+
Previously more than 10 were allowed but this was a bug and was fixed to
|
|
45
|
+
limit the load on the server.
|
|
37
46
|
|
|
38
47
|
## [3.0.2] - 2019-06-22
|
|
39
48
|
### Changed
|
|
40
|
-
- Updated the validation check for region codes so it supports ISO 3166-2.
|
|
41
|
-
- Disabled the validation check that limited the number of areas to 10 as
|
|
49
|
+
- Updated the validation check for region codes so it supports ISO 3166-2.
|
|
50
|
+
- Disabled the validation check that limited the number of areas to 10 as
|
|
42
51
|
the eBird API does not currently enforce this.
|
|
43
52
|
|
|
44
53
|
## [3.0.1] - 2019-06-15
|
|
45
|
-
### Added
|
|
54
|
+
### Added
|
|
46
55
|
- Added the full list of locales support by eBird (but not necessarily by the API).
|
|
47
56
|
- Added a convenience function for saving downloaded records to a file.
|
|
48
57
|
### Changed
|
|
49
58
|
- Validating the locale now uses the list supported by eBird.
|
|
50
59
|
|
|
51
60
|
## [3.0.0] - 2019-06-06
|
|
52
|
-
### Added
|
|
61
|
+
### Added
|
|
53
62
|
- Rewritten to support eBird API 2.0
|
|
54
63
|
|
|
55
64
|
## [2.1.1] - 2019-05-14
|
|
@@ -61,31 +70,31 @@ and by implication, [Semantic Versioning](http://semver.org/).
|
|
|
61
70
|
- Improved the documentation in the README.
|
|
62
71
|
- Project now uses the MIT license.
|
|
63
72
|
|
|
64
|
-
### Added
|
|
73
|
+
### Added
|
|
65
74
|
- Added scripts so each API call can be made on the command line.
|
|
66
75
|
|
|
67
76
|
## [2.0.0] - 2017-02-27
|
|
68
|
-
### Changed
|
|
77
|
+
### Changed
|
|
69
78
|
- Moved all the functions into the 'api' module and changed the top-level
|
|
70
79
|
'ebird' module to be namespaced (PEP420).
|
|
71
80
|
|
|
72
81
|
## [1.0.2] - 2017-02-23
|
|
73
|
-
### Changed
|
|
82
|
+
### Changed
|
|
74
83
|
- Corrected version number in python.
|
|
75
84
|
|
|
76
85
|
## [1.0.1] - 2017-02-21
|
|
77
|
-
### Added
|
|
86
|
+
### Added
|
|
78
87
|
- Updated docstrings to report exceptions raised.
|
|
79
88
|
|
|
80
89
|
## [1.0.0] - 2017-02-21
|
|
81
|
-
### Added
|
|
90
|
+
### Added
|
|
82
91
|
- Added function for Google Gadgets showing recent observations.
|
|
83
92
|
- Added function for fetching lists of species.
|
|
84
93
|
- Added function for fetching nearby hotspots.
|
|
85
94
|
- Added function for fetching lists of hotspots for a region.
|
|
86
95
|
### Changed
|
|
87
|
-
- Renamed list_locations() to list_regions() and find_locations() to
|
|
88
|
-
find_regions() as "locations" refer to specific sites in the functions
|
|
96
|
+
- Renamed list_locations() to list_regions() and find_locations() to
|
|
97
|
+
find_regions() as "locations" refer to specific sites in the functions
|
|
89
98
|
that fetch observations.
|
|
90
99
|
|
|
91
100
|
## [0.2.0] - 2017-02-18
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ebird-api
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.1.1
|
|
4
4
|
Summary: Wrapper for accessing the eBird API
|
|
5
5
|
Author-email: Project Babbler <projectbabbler@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -68,19 +68,25 @@ what you want to do - they will be interested to hear it.
|
|
|
68
68
|
### Observations
|
|
69
69
|
|
|
70
70
|
```python
|
|
71
|
+
import os
|
|
72
|
+
|
|
71
73
|
from ebird.api import get_observations
|
|
74
|
+
|
|
75
|
+
# Always store secrets outside the code, so you don't accidentally
|
|
76
|
+
# commit them. Environment variables are ideal for this.
|
|
77
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
72
78
|
|
|
73
79
|
# Get observations from Woodman Pond, Madison county, New York for the past week.
|
|
74
|
-
|
|
80
|
+
this_week = get_observations(api_key, 'L227544', back=7)
|
|
75
81
|
|
|
76
82
|
# Get observations from Madison county, New York
|
|
77
|
-
|
|
83
|
+
country_records = get_observations(api_key, 'US-NY-053')
|
|
78
84
|
|
|
79
85
|
# Get observations from New York
|
|
80
|
-
|
|
86
|
+
state_records = get_observations(api_key, 'US-NY')
|
|
81
87
|
|
|
82
88
|
# Get observations from the USA - don't overdo the data downloads
|
|
83
|
-
|
|
89
|
+
national_records = get_observations(api_key, 'US')
|
|
84
90
|
```
|
|
85
91
|
|
|
86
92
|
Any where you pass in single location or region you can also pass in a
|
|
@@ -88,8 +94,12 @@ list or a comma-separated string. You can specify up to 10 locations or
|
|
|
88
94
|
regions:
|
|
89
95
|
|
|
90
96
|
```python
|
|
97
|
+
import os
|
|
98
|
+
|
|
91
99
|
from ebird.api import get_observations
|
|
92
100
|
|
|
101
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
102
|
+
|
|
93
103
|
# Get the observations for the most visited locations in Madison county, New York:
|
|
94
104
|
# Woodman Pond, Ditch Bank Rd., Cornell Biological Field Station and
|
|
95
105
|
# Anne V Pickard Memorial Wildlife Overlook.
|
|
@@ -101,11 +111,17 @@ counties = 'US-NY-103,US-NY-059,US-NY-81'
|
|
|
101
111
|
records = get_observations(api_key, locations, hotspot=False, category='species')
|
|
102
112
|
```
|
|
103
113
|
|
|
104
|
-
The common name for species can be returned in different languages by
|
|
114
|
+
The common name for species can be returned in different languages by
|
|
115
|
+
specifying locale in the functions that return observations, checklists
|
|
116
|
+
or taxonomy:
|
|
105
117
|
|
|
106
118
|
```python
|
|
119
|
+
import os
|
|
120
|
+
|
|
107
121
|
from ebird.api import get_observations
|
|
108
122
|
|
|
123
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
124
|
+
|
|
109
125
|
records = get_observations(api_key, 'CA-QC', locale='fr')
|
|
110
126
|
```
|
|
111
127
|
|
|
@@ -115,8 +131,12 @@ geographical area - useful for finding the nearest place to see a given
|
|
|
115
131
|
species:
|
|
116
132
|
|
|
117
133
|
```python
|
|
134
|
+
import os
|
|
135
|
+
|
|
118
136
|
from ebird.api import get_nearby_observations
|
|
119
137
|
|
|
138
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
139
|
+
|
|
120
140
|
# Get the most recent sightings of all species seen in the last week within
|
|
121
141
|
# 10km of Point Reyes National Seashore.
|
|
122
142
|
records = get_nearby_observations(api_key, 38.05, -122.94, dist=10, back=7)
|
|
@@ -128,30 +148,42 @@ notable ones (locally or nationally rare species) or limit the records to
|
|
|
128
148
|
a small number of species:
|
|
129
149
|
|
|
130
150
|
```python
|
|
131
|
-
|
|
132
|
-
|
|
151
|
+
import os
|
|
152
|
+
|
|
153
|
+
from ebird.api import (
|
|
154
|
+
get_notable_observations,
|
|
155
|
+
get_nearby_notable,
|
|
156
|
+
get_species_observations,
|
|
157
|
+
get_nearby_species,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
133
161
|
|
|
134
162
|
# Get the interesting birds seen in New York state.
|
|
135
|
-
|
|
163
|
+
notables = get_notable_observations(api_key, 'US-NY')
|
|
136
164
|
|
|
137
165
|
# Get the observations of Horned Lark (Eremophila alpestris) in New York state.
|
|
138
166
|
records = get_species_observations(api_key, 'horlar', 'US-NY')
|
|
139
167
|
|
|
140
168
|
# Get the interesting birds within 50kn of Point Reyes
|
|
141
|
-
|
|
169
|
+
nearby_notables = get_nearby_notable(api_key, 38.05, -122.94, dist=50)
|
|
142
170
|
|
|
143
171
|
# Find out if Barn Swallows have been seen in the area in the past 10 days
|
|
144
|
-
|
|
172
|
+
nearby_species = get_nearby_species(api_key, 'barswa', 38.05, -122.94, back=10)
|
|
145
173
|
```
|
|
146
174
|
|
|
147
175
|
For the more travel-minded you can also find out the nearest place to see a given species:
|
|
148
176
|
|
|
149
177
|
```python
|
|
178
|
+
import os
|
|
179
|
+
|
|
150
180
|
from ebird.api import get_nearest_species
|
|
151
181
|
|
|
182
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
183
|
+
|
|
152
184
|
# Where is the closest place to Cornell Lab of Ornithology to see
|
|
153
185
|
# Tennessee Warbler.
|
|
154
|
-
locations = get_nearest_species('tenwar', 42.48, -76.45)
|
|
186
|
+
locations = get_nearest_species(api_key, 'tenwar', 42.48, -76.45)
|
|
155
187
|
```
|
|
156
188
|
|
|
157
189
|
Depending on what time of year you try this, you might have a long way to go.
|
|
@@ -164,13 +196,17 @@ using get_visits(). Each result returned has the unique identifier for the
|
|
|
164
196
|
checklist. You can then call get_checklist() to get the list of observations.
|
|
165
197
|
|
|
166
198
|
```python
|
|
199
|
+
import os
|
|
200
|
+
|
|
167
201
|
from ebird.api import get_visits, get_checklist
|
|
168
202
|
|
|
203
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
204
|
+
|
|
169
205
|
# Get visits made recently to locations in New York state:
|
|
170
|
-
|
|
206
|
+
visits = get_visits(api_key, 'US-NY')
|
|
171
207
|
|
|
172
208
|
# Get visits made recently to locations in New York state on Jan 1st 2010
|
|
173
|
-
|
|
209
|
+
recent_visits = get_visits(api_key, 'US-NY', '2010-01-01')
|
|
174
210
|
|
|
175
211
|
# Get the details of a checklist
|
|
176
212
|
checklist = get_checklist(api_key, 'S22536787')
|
|
@@ -185,17 +221,18 @@ hotspots within a given radius. get_hotspot() can be used to get information
|
|
|
185
221
|
on the location of a given hotspot.
|
|
186
222
|
|
|
187
223
|
```python
|
|
224
|
+
import os
|
|
225
|
+
|
|
188
226
|
from ebird.api import get_hotspots, get_nearby_hotspots, get_hotspot
|
|
189
227
|
|
|
228
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
229
|
+
|
|
190
230
|
# List all the hotspots in New York state.
|
|
191
231
|
hotspots = get_hotspots(api_key, 'US-NY')
|
|
192
232
|
|
|
193
233
|
# List all the hotspots in New York state visited in the past week.
|
|
194
234
|
recent = get_hotspots(api_key, 'US-NY', back=7)
|
|
195
235
|
|
|
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
236
|
# List all the hotspots in within 50kn of Point Reyes
|
|
200
237
|
nearby = get_nearby_hotspots(api_key, 38.05, -122.94, dist=50)
|
|
201
238
|
|
|
@@ -211,8 +248,12 @@ list of sub-regions for a given region. For the approximate area covered
|
|
|
211
248
|
by a region use get_region().
|
|
212
249
|
|
|
213
250
|
```python
|
|
251
|
+
import os
|
|
252
|
+
|
|
214
253
|
from ebird.api import get_regions, get_adjacent_regions, get_region
|
|
215
254
|
|
|
255
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
256
|
+
|
|
216
257
|
# Get the list of countries in the world.
|
|
217
258
|
countries = get_regions(api_key, 'country', 'world')
|
|
218
259
|
|
|
@@ -238,8 +279,12 @@ e.g. horlar (Horned Lark), cangoo (Canada Goose), etc.,
|
|
|
238
279
|
that are used in the other API calls.
|
|
239
280
|
|
|
240
281
|
```python
|
|
282
|
+
import os
|
|
283
|
+
|
|
241
284
|
from ebird.api import get_taxonomy, get_taxonomy_forms, get_taxonomy_versions
|
|
242
285
|
|
|
286
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
287
|
+
|
|
243
288
|
# Get all the species in the eBird taxonomy.
|
|
244
289
|
taxonomy = get_taxonomy(api_key)
|
|
245
290
|
|
|
@@ -266,9 +311,13 @@ just for a specific day so it is really only useful for "Big Days" when
|
|
|
266
311
|
lots of people are out trying to get the greatest number of species.
|
|
267
312
|
|
|
268
313
|
```python
|
|
314
|
+
import os
|
|
315
|
+
|
|
269
316
|
from datetime import date
|
|
270
317
|
from ebird.api import get_top_100, get_totals
|
|
271
318
|
|
|
319
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
320
|
+
|
|
272
321
|
# Get the winner of the Global Big Day in New York, on 5th May 2018
|
|
273
322
|
winners = get_top_100(api_key, 'US-NY', '2018-05-05')
|
|
274
323
|
|
|
@@ -283,9 +332,11 @@ You can set the API key and locale when creating a Client instance so you don't
|
|
|
283
332
|
have to keep passing them as arguments.
|
|
284
333
|
|
|
285
334
|
```python
|
|
335
|
+
import os
|
|
336
|
+
|
|
286
337
|
from ebird.api import Client
|
|
287
338
|
|
|
288
|
-
api_key =
|
|
339
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
289
340
|
locale = 'es'
|
|
290
341
|
|
|
291
342
|
client = Client(api_key, locale)
|
|
@@ -305,7 +356,9 @@ only returns JSON.
|
|
|
305
356
|
|
|
306
357
|
## Compatibility
|
|
307
358
|
|
|
308
|
-
ebird-api works with Python 3.
|
|
359
|
+
ebird-api works with currently supported versions of Python, 3.8+. However,
|
|
360
|
+
it is known to work with earlier versions, at least 3.5 - 3.7, without any
|
|
361
|
+
problems.
|
|
309
362
|
|
|
310
363
|
## Links
|
|
311
364
|
|
|
@@ -38,19 +38,25 @@ what you want to do - they will be interested to hear it.
|
|
|
38
38
|
### Observations
|
|
39
39
|
|
|
40
40
|
```python
|
|
41
|
+
import os
|
|
42
|
+
|
|
41
43
|
from ebird.api import get_observations
|
|
44
|
+
|
|
45
|
+
# Always store secrets outside the code, so you don't accidentally
|
|
46
|
+
# commit them. Environment variables are ideal for this.
|
|
47
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
42
48
|
|
|
43
49
|
# Get observations from Woodman Pond, Madison county, New York for the past week.
|
|
44
|
-
|
|
50
|
+
this_week = get_observations(api_key, 'L227544', back=7)
|
|
45
51
|
|
|
46
52
|
# Get observations from Madison county, New York
|
|
47
|
-
|
|
53
|
+
country_records = get_observations(api_key, 'US-NY-053')
|
|
48
54
|
|
|
49
55
|
# Get observations from New York
|
|
50
|
-
|
|
56
|
+
state_records = get_observations(api_key, 'US-NY')
|
|
51
57
|
|
|
52
58
|
# Get observations from the USA - don't overdo the data downloads
|
|
53
|
-
|
|
59
|
+
national_records = get_observations(api_key, 'US')
|
|
54
60
|
```
|
|
55
61
|
|
|
56
62
|
Any where you pass in single location or region you can also pass in a
|
|
@@ -58,8 +64,12 @@ list or a comma-separated string. You can specify up to 10 locations or
|
|
|
58
64
|
regions:
|
|
59
65
|
|
|
60
66
|
```python
|
|
67
|
+
import os
|
|
68
|
+
|
|
61
69
|
from ebird.api import get_observations
|
|
62
70
|
|
|
71
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
72
|
+
|
|
63
73
|
# Get the observations for the most visited locations in Madison county, New York:
|
|
64
74
|
# Woodman Pond, Ditch Bank Rd., Cornell Biological Field Station and
|
|
65
75
|
# Anne V Pickard Memorial Wildlife Overlook.
|
|
@@ -71,11 +81,17 @@ counties = 'US-NY-103,US-NY-059,US-NY-81'
|
|
|
71
81
|
records = get_observations(api_key, locations, hotspot=False, category='species')
|
|
72
82
|
```
|
|
73
83
|
|
|
74
|
-
The common name for species can be returned in different languages by
|
|
84
|
+
The common name for species can be returned in different languages by
|
|
85
|
+
specifying locale in the functions that return observations, checklists
|
|
86
|
+
or taxonomy:
|
|
75
87
|
|
|
76
88
|
```python
|
|
89
|
+
import os
|
|
90
|
+
|
|
77
91
|
from ebird.api import get_observations
|
|
78
92
|
|
|
93
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
94
|
+
|
|
79
95
|
records = get_observations(api_key, 'CA-QC', locale='fr')
|
|
80
96
|
```
|
|
81
97
|
|
|
@@ -85,8 +101,12 @@ geographical area - useful for finding the nearest place to see a given
|
|
|
85
101
|
species:
|
|
86
102
|
|
|
87
103
|
```python
|
|
104
|
+
import os
|
|
105
|
+
|
|
88
106
|
from ebird.api import get_nearby_observations
|
|
89
107
|
|
|
108
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
109
|
+
|
|
90
110
|
# Get the most recent sightings of all species seen in the last week within
|
|
91
111
|
# 10km of Point Reyes National Seashore.
|
|
92
112
|
records = get_nearby_observations(api_key, 38.05, -122.94, dist=10, back=7)
|
|
@@ -98,30 +118,42 @@ notable ones (locally or nationally rare species) or limit the records to
|
|
|
98
118
|
a small number of species:
|
|
99
119
|
|
|
100
120
|
```python
|
|
101
|
-
|
|
102
|
-
|
|
121
|
+
import os
|
|
122
|
+
|
|
123
|
+
from ebird.api import (
|
|
124
|
+
get_notable_observations,
|
|
125
|
+
get_nearby_notable,
|
|
126
|
+
get_species_observations,
|
|
127
|
+
get_nearby_species,
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
103
131
|
|
|
104
132
|
# Get the interesting birds seen in New York state.
|
|
105
|
-
|
|
133
|
+
notables = get_notable_observations(api_key, 'US-NY')
|
|
106
134
|
|
|
107
135
|
# Get the observations of Horned Lark (Eremophila alpestris) in New York state.
|
|
108
136
|
records = get_species_observations(api_key, 'horlar', 'US-NY')
|
|
109
137
|
|
|
110
138
|
# Get the interesting birds within 50kn of Point Reyes
|
|
111
|
-
|
|
139
|
+
nearby_notables = get_nearby_notable(api_key, 38.05, -122.94, dist=50)
|
|
112
140
|
|
|
113
141
|
# Find out if Barn Swallows have been seen in the area in the past 10 days
|
|
114
|
-
|
|
142
|
+
nearby_species = get_nearby_species(api_key, 'barswa', 38.05, -122.94, back=10)
|
|
115
143
|
```
|
|
116
144
|
|
|
117
145
|
For the more travel-minded you can also find out the nearest place to see a given species:
|
|
118
146
|
|
|
119
147
|
```python
|
|
148
|
+
import os
|
|
149
|
+
|
|
120
150
|
from ebird.api import get_nearest_species
|
|
121
151
|
|
|
152
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
153
|
+
|
|
122
154
|
# Where is the closest place to Cornell Lab of Ornithology to see
|
|
123
155
|
# Tennessee Warbler.
|
|
124
|
-
locations = get_nearest_species('tenwar', 42.48, -76.45)
|
|
156
|
+
locations = get_nearest_species(api_key, 'tenwar', 42.48, -76.45)
|
|
125
157
|
```
|
|
126
158
|
|
|
127
159
|
Depending on what time of year you try this, you might have a long way to go.
|
|
@@ -134,13 +166,17 @@ using get_visits(). Each result returned has the unique identifier for the
|
|
|
134
166
|
checklist. You can then call get_checklist() to get the list of observations.
|
|
135
167
|
|
|
136
168
|
```python
|
|
169
|
+
import os
|
|
170
|
+
|
|
137
171
|
from ebird.api import get_visits, get_checklist
|
|
138
172
|
|
|
173
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
174
|
+
|
|
139
175
|
# Get visits made recently to locations in New York state:
|
|
140
|
-
|
|
176
|
+
visits = get_visits(api_key, 'US-NY')
|
|
141
177
|
|
|
142
178
|
# Get visits made recently to locations in New York state on Jan 1st 2010
|
|
143
|
-
|
|
179
|
+
recent_visits = get_visits(api_key, 'US-NY', '2010-01-01')
|
|
144
180
|
|
|
145
181
|
# Get the details of a checklist
|
|
146
182
|
checklist = get_checklist(api_key, 'S22536787')
|
|
@@ -155,17 +191,18 @@ hotspots within a given radius. get_hotspot() can be used to get information
|
|
|
155
191
|
on the location of a given hotspot.
|
|
156
192
|
|
|
157
193
|
```python
|
|
194
|
+
import os
|
|
195
|
+
|
|
158
196
|
from ebird.api import get_hotspots, get_nearby_hotspots, get_hotspot
|
|
159
197
|
|
|
198
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
199
|
+
|
|
160
200
|
# List all the hotspots in New York state.
|
|
161
201
|
hotspots = get_hotspots(api_key, 'US-NY')
|
|
162
202
|
|
|
163
203
|
# List all the hotspots in New York state visited in the past week.
|
|
164
204
|
recent = get_hotspots(api_key, 'US-NY', back=7)
|
|
165
205
|
|
|
166
|
-
# List all the hotspots in New York state visited in the past week.
|
|
167
|
-
recent = get_hotspots(api_key, 'US-NY', back=7)
|
|
168
|
-
|
|
169
206
|
# List all the hotspots in within 50kn of Point Reyes
|
|
170
207
|
nearby = get_nearby_hotspots(api_key, 38.05, -122.94, dist=50)
|
|
171
208
|
|
|
@@ -181,8 +218,12 @@ list of sub-regions for a given region. For the approximate area covered
|
|
|
181
218
|
by a region use get_region().
|
|
182
219
|
|
|
183
220
|
```python
|
|
221
|
+
import os
|
|
222
|
+
|
|
184
223
|
from ebird.api import get_regions, get_adjacent_regions, get_region
|
|
185
224
|
|
|
225
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
226
|
+
|
|
186
227
|
# Get the list of countries in the world.
|
|
187
228
|
countries = get_regions(api_key, 'country', 'world')
|
|
188
229
|
|
|
@@ -208,8 +249,12 @@ e.g. horlar (Horned Lark), cangoo (Canada Goose), etc.,
|
|
|
208
249
|
that are used in the other API calls.
|
|
209
250
|
|
|
210
251
|
```python
|
|
252
|
+
import os
|
|
253
|
+
|
|
211
254
|
from ebird.api import get_taxonomy, get_taxonomy_forms, get_taxonomy_versions
|
|
212
255
|
|
|
256
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
257
|
+
|
|
213
258
|
# Get all the species in the eBird taxonomy.
|
|
214
259
|
taxonomy = get_taxonomy(api_key)
|
|
215
260
|
|
|
@@ -236,9 +281,13 @@ just for a specific day so it is really only useful for "Big Days" when
|
|
|
236
281
|
lots of people are out trying to get the greatest number of species.
|
|
237
282
|
|
|
238
283
|
```python
|
|
284
|
+
import os
|
|
285
|
+
|
|
239
286
|
from datetime import date
|
|
240
287
|
from ebird.api import get_top_100, get_totals
|
|
241
288
|
|
|
289
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
290
|
+
|
|
242
291
|
# Get the winner of the Global Big Day in New York, on 5th May 2018
|
|
243
292
|
winners = get_top_100(api_key, 'US-NY', '2018-05-05')
|
|
244
293
|
|
|
@@ -253,9 +302,11 @@ You can set the API key and locale when creating a Client instance so you don't
|
|
|
253
302
|
have to keep passing them as arguments.
|
|
254
303
|
|
|
255
304
|
```python
|
|
305
|
+
import os
|
|
306
|
+
|
|
256
307
|
from ebird.api import Client
|
|
257
308
|
|
|
258
|
-
api_key =
|
|
309
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
259
310
|
locale = 'es'
|
|
260
311
|
|
|
261
312
|
client = Client(api_key, locale)
|
|
@@ -275,7 +326,9 @@ only returns JSON.
|
|
|
275
326
|
|
|
276
327
|
## Compatibility
|
|
277
328
|
|
|
278
|
-
ebird-api works with Python 3.
|
|
329
|
+
ebird-api works with currently supported versions of Python, 3.8+. However,
|
|
330
|
+
it is known to work with earlier versions, at least 3.5 - 3.7, without any
|
|
331
|
+
problems.
|
|
279
332
|
|
|
280
333
|
## Links
|
|
281
334
|
|
|
@@ -0,0 +1,127 @@
|
|
|
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.1.1"
|
|
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.bumpversion]
|
|
41
|
+
current_version = "3.1.1"
|
|
42
|
+
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
|
43
|
+
serialize = ["{major}.{minor}.{patch}"]
|
|
44
|
+
ignore_missing_version = false
|
|
45
|
+
tag = true
|
|
46
|
+
sign_tags = true
|
|
47
|
+
tag_name = "v{new_version}"
|
|
48
|
+
tag_message = "New version: {current_version} → {new_version}"
|
|
49
|
+
allow_dirty = false
|
|
50
|
+
commit = true
|
|
51
|
+
message = "New version: {current_version} → {new_version}"
|
|
52
|
+
commit_args = ""
|
|
53
|
+
|
|
54
|
+
[[tool.bumpversion.files]]
|
|
55
|
+
filename = "src/ebird/api/__init__.py"
|
|
56
|
+
search = '__version__ = "{current_version}"'
|
|
57
|
+
replace = '__version__ = "{new_version}"'
|
|
58
|
+
|
|
59
|
+
[[tool.bumpversion.files]]
|
|
60
|
+
filename = "CHANGELOG.md"
|
|
61
|
+
search = "## [Unreleased]"
|
|
62
|
+
replace = "## [{new_version}] - {now:%Y-%m-%d}"
|
|
63
|
+
|
|
64
|
+
[[tool.bumpversion.files]]
|
|
65
|
+
filename = "pyproject.toml"
|
|
66
|
+
search = 'version = "{current_version}"'
|
|
67
|
+
replace = 'version = "{new_version}"'
|
|
68
|
+
|
|
69
|
+
[[tool.bumpversion.files]]
|
|
70
|
+
filename = "CITATION.cff"
|
|
71
|
+
search = "version: {current_version}"
|
|
72
|
+
replace = "version: {new_version}"
|
|
73
|
+
|
|
74
|
+
[[tool.bumpversion.files]]
|
|
75
|
+
filename = "CITATION.cff"
|
|
76
|
+
search = "^date-released: \\d{{4}}-\\d{{2}}-\\d{{2}}$"
|
|
77
|
+
replace = "date-released: {now:%Y-%m-%d}"
|
|
78
|
+
regex = true
|
|
79
|
+
|
|
80
|
+
[tool.coverage.run]
|
|
81
|
+
branch = true
|
|
82
|
+
|
|
83
|
+
[tool.isort]
|
|
84
|
+
multi_line_output = 3
|
|
85
|
+
include_trailing_comma = true
|
|
86
|
+
|
|
87
|
+
[tool.pytest.ini_options]
|
|
88
|
+
pythonpath = [
|
|
89
|
+
"."
|
|
90
|
+
]
|
|
91
|
+
testpaths = [
|
|
92
|
+
"tests/unit"
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
[tool.tox]
|
|
96
|
+
legacy_tox_ini = """
|
|
97
|
+
[tox]
|
|
98
|
+
requires =
|
|
99
|
+
tox>=4.2
|
|
100
|
+
tox-uv>=1.11.3
|
|
101
|
+
envlist = py38, py39, py310, py311, py312
|
|
102
|
+
|
|
103
|
+
[testenv]
|
|
104
|
+
commands = pytest
|
|
105
|
+
deps =
|
|
106
|
+
pytest
|
|
107
|
+
setenv =
|
|
108
|
+
PYTHONPATH = src
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
[tool.uv]
|
|
112
|
+
dev-dependencies = [
|
|
113
|
+
"bump-my-version>=0.28.0",
|
|
114
|
+
"coverage>=7.6.1",
|
|
115
|
+
"flake8>=5.0.4",
|
|
116
|
+
"geopy>=2.4.1",
|
|
117
|
+
"isort>=5.13.2",
|
|
118
|
+
"pytest>=8.3.3",
|
|
119
|
+
"pytest-cov>=5.0.0",
|
|
120
|
+
"tox>=4.23.1",
|
|
121
|
+
"tox-uv>=1.11.3",
|
|
122
|
+
"pre-commit>=3.5.0",
|
|
123
|
+
"ruff>=0.8.0",
|
|
124
|
+
]
|
|
125
|
+
|
|
126
|
+
[tool.uv.sources]
|
|
127
|
+
ebird-api = { workspace = true }
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
"""A set of wrapper functions for accessing the eBird API."""
|
|
4
4
|
|
|
5
|
-
__version__ = "3.
|
|
5
|
+
__version__ = "3.1.1"
|
|
6
6
|
|
|
7
7
|
from ebird.api.checklists import get_checklist, get_visits
|
|
8
8
|
from ebird.api.client import Client
|
|
@@ -24,5 +24,6 @@ from ebird.api.taxonomy import (
|
|
|
24
24
|
get_taxonomy,
|
|
25
25
|
get_taxonomy_forms,
|
|
26
26
|
get_taxonomy_groups,
|
|
27
|
+
get_taxonomy_locales,
|
|
27
28
|
get_taxonomy_versions,
|
|
28
29
|
)
|
|
@@ -8,9 +8,9 @@ from ebird.api.validation import (
|
|
|
8
8
|
clean_max_checklists,
|
|
9
9
|
)
|
|
10
10
|
|
|
11
|
-
CHECKLISTS_DATE_URL = "https://ebird.org/
|
|
12
|
-
CHECKLISTS_RECENT_URL = "https://ebird.org/
|
|
13
|
-
CHECKLIST_URL = "https://ebird.org/
|
|
11
|
+
CHECKLISTS_DATE_URL = "https://api.ebird.org/v2/product/lists/%s/%s"
|
|
12
|
+
CHECKLISTS_RECENT_URL = "https://api.ebird.org/v2/product/lists/%s"
|
|
13
|
+
CHECKLIST_URL = "https://api.ebird.org/v2/product/checklist/view/%s"
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def get_visits(token, area, date=None, max_results=10):
|
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
"""Classes for simplifying calls to the eBird API."""
|
|
4
4
|
|
|
5
|
-
from ebird.api import
|
|
5
|
+
from ebird.api import (
|
|
6
|
+
checklists,
|
|
7
|
+
hotspots,
|
|
8
|
+
observations,
|
|
9
|
+
regions,
|
|
10
|
+
statistics,
|
|
11
|
+
taxonomy,
|
|
12
|
+
)
|
|
6
13
|
from ebird.api.validation import clean_locale
|
|
7
14
|
|
|
8
15
|
|
|
@@ -10,9 +10,9 @@ from ebird.api.validation import (
|
|
|
10
10
|
clean_region,
|
|
11
11
|
)
|
|
12
12
|
|
|
13
|
-
REGION_HOTSPOTS_URL = "https://ebird.org/
|
|
14
|
-
NEARBY_HOTSPOTS_URL = "https://ebird.org/
|
|
15
|
-
HOTSPOT_INFO_URL = "https://ebird.org/
|
|
13
|
+
REGION_HOTSPOTS_URL = "https://api.ebird.org/v2/ref/hotspot/%s"
|
|
14
|
+
NEARBY_HOTSPOTS_URL = "https://api.ebird.org/v2/ref/hotspot/geo"
|
|
15
|
+
HOTSPOT_INFO_URL = "https://api.ebird.org/v2/ref/hotspot/info/%s"
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
def get_hotspots(token, region, back=None):
|
|
@@ -21,7 +21,7 @@ def get_hotspots(token, region, back=None):
|
|
|
21
21
|
If back is specified then only the hotspots visited in the given number
|
|
22
22
|
of days are returned.
|
|
23
23
|
|
|
24
|
-
Fetch all the hotspots visited in
|
|
24
|
+
Fetch all the hotspots visited in a country, subnational1 or subnational2
|
|
25
25
|
area recently (up to 30 days ago).
|
|
26
26
|
|
|
27
27
|
This maps to the end point in the eBird API 2.0,
|
|
@@ -18,18 +18,18 @@ from ebird.api.validation import (
|
|
|
18
18
|
clean_sort,
|
|
19
19
|
)
|
|
20
20
|
|
|
21
|
-
OBSERVATIONS_URL = "https://ebird.org/
|
|
22
|
-
NOTABLE_OBSERVATIONS_URL = "https://ebird.org/
|
|
23
|
-
SPECIES_OBSERVATIONS_URL = "https://ebird.org/
|
|
21
|
+
OBSERVATIONS_URL = "https://api.ebird.org/v2/data/obs/%s/recent"
|
|
22
|
+
NOTABLE_OBSERVATIONS_URL = "https://api.ebird.org/v2/data/obs/%s/recent/notable"
|
|
23
|
+
SPECIES_OBSERVATIONS_URL = "https://api.ebird.org/v2/data/obs/%s/recent/%s"
|
|
24
24
|
|
|
25
|
-
NEARBY_OBSERVATIONS_URL = "https://ebird.org/
|
|
26
|
-
NEARBY_NOTABLE_URL = "https://ebird.org/
|
|
27
|
-
NEARBY_SPECIES_URL = "https://ebird.org/
|
|
25
|
+
NEARBY_OBSERVATIONS_URL = "https://api.ebird.org/v2/data/obs/geo/recent"
|
|
26
|
+
NEARBY_NOTABLE_URL = "https://api.ebird.org/v2/data/obs/geo/recent/notable"
|
|
27
|
+
NEARBY_SPECIES_URL = "https://api.ebird.org/v2/data/obs/geo/recent/%s"
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
NEAREST_SPECIES_URL = "https://ebird.org/
|
|
30
|
+
NEAREST_SPECIES_URL = "https://api.ebird.org/v2/data/nearest/geo/recent/%s"
|
|
31
31
|
|
|
32
|
-
HISTORIC_OBSERVATIONS_URL = "https://ebird.org/
|
|
32
|
+
HISTORIC_OBSERVATIONS_URL = "https://api.ebird.org/v2/data/obs/%s/historic/%s"
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
def get_observations(
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
from ebird.api.utils import call
|
|
4
4
|
from ebird.api.validation import clean_region, clean_region_type
|
|
5
5
|
|
|
6
|
-
REGION_LIST_URL = "https://ebird.org/
|
|
7
|
-
ADJACENT_REGIONS_URL = "https://ebird.org/
|
|
8
|
-
REGION_INFO_URL = "https://ebird.org/
|
|
6
|
+
REGION_LIST_URL = "https://api.ebird.org/v2/ref/region/list/%s/%s.json"
|
|
7
|
+
ADJACENT_REGIONS_URL = "https://api.ebird.org/v2/ref/adjacent/%s"
|
|
8
|
+
REGION_INFO_URL = "https://api.ebird.org/v2/ref/region/info/%s"
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
def get_regions(token, rtype, region):
|
|
@@ -9,8 +9,8 @@ from ebird.api.validation import (
|
|
|
9
9
|
clean_region,
|
|
10
10
|
)
|
|
11
11
|
|
|
12
|
-
TOP_100_URL = "https://ebird.org/
|
|
13
|
-
TOTALS_URL = "https://ebird.org/
|
|
12
|
+
TOP_100_URL = "https://api.ebird.org/v2/product/top100/%s/%s"
|
|
13
|
+
TOTALS_URL = "https://api.ebird.org/v2/product/stats/%s/%s"
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def get_top_100(token, region, date, rank="spp", max_results=100):
|
|
@@ -9,10 +9,11 @@ from ebird.api.validation import (
|
|
|
9
9
|
clean_species_code,
|
|
10
10
|
)
|
|
11
11
|
|
|
12
|
-
TAXONOMY_URL = "https://ebird.org/
|
|
13
|
-
TAXONOMY_FORMS_URL = "https://ebird.org/
|
|
14
|
-
TAXONOMY_GROUPS_URL = "https://ebird.org/
|
|
15
|
-
TAXONOMY_VERSIONS_URL = "https://ebird.org/
|
|
12
|
+
TAXONOMY_URL = "https://api.ebird.org/v2/ref/taxonomy/ebird"
|
|
13
|
+
TAXONOMY_FORMS_URL = "https://api.ebird.org/v2/ref/taxon/forms/%s"
|
|
14
|
+
TAXONOMY_GROUPS_URL = "https://api.ebird.org/v2/ref/sppgroup/%s"
|
|
15
|
+
TAXONOMY_VERSIONS_URL = "https://api.ebird.org/v2/ref/taxonomy/versions"
|
|
16
|
+
TAXONOMY_LOCALES_URL = "https://api.ebird.org/v2/ref/taxa-locales/ebird"
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
def get_taxonomy(token, category=None, locale="en", version=None, species=None):
|
|
@@ -180,3 +181,33 @@ def get_taxonomy_versions(token):
|
|
|
180
181
|
}
|
|
181
182
|
|
|
182
183
|
return call(TAXONOMY_VERSIONS_URL, {}, headers)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def get_taxonomy_locales(token):
|
|
187
|
+
"""Get all locales supported for common names.
|
|
188
|
+
|
|
189
|
+
The maps to the end point in the eBird API 2.0,
|
|
190
|
+
https://documenter.getpostman.com/view/664302/S1ENwy59?version=latest#3ea8ff71-c254-4811-9e80-b445a39302a6
|
|
191
|
+
|
|
192
|
+
This API call returns a list of all the languages supported
|
|
193
|
+
by eBird. An entry in the list takes the form:
|
|
194
|
+
|
|
195
|
+
{'code': 'af', 'lastUpdate': '2024-12-21 06:06', 'name': 'Afrikaans'}
|
|
196
|
+
|
|
197
|
+
There are currently, (2024-12-30), 107 languages available.
|
|
198
|
+
|
|
199
|
+
:param token: the token needed to access the API.
|
|
200
|
+
|
|
201
|
+
:return: a list of all the taxonomy locales used by eBird.
|
|
202
|
+
|
|
203
|
+
:raises URLError if there is an error with the connection to the
|
|
204
|
+
eBird site.
|
|
205
|
+
|
|
206
|
+
:raises HTTPError if the eBird API returns an error.
|
|
207
|
+
|
|
208
|
+
"""
|
|
209
|
+
headers = {
|
|
210
|
+
"X-eBirdApiToken": token,
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return call(TAXONOMY_LOCALES_URL, {}, headers)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ebird-api
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.1.1
|
|
4
4
|
Summary: Wrapper for accessing the eBird API
|
|
5
5
|
Author-email: Project Babbler <projectbabbler@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -68,19 +68,25 @@ what you want to do - they will be interested to hear it.
|
|
|
68
68
|
### Observations
|
|
69
69
|
|
|
70
70
|
```python
|
|
71
|
+
import os
|
|
72
|
+
|
|
71
73
|
from ebird.api import get_observations
|
|
74
|
+
|
|
75
|
+
# Always store secrets outside the code, so you don't accidentally
|
|
76
|
+
# commit them. Environment variables are ideal for this.
|
|
77
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
72
78
|
|
|
73
79
|
# Get observations from Woodman Pond, Madison county, New York for the past week.
|
|
74
|
-
|
|
80
|
+
this_week = get_observations(api_key, 'L227544', back=7)
|
|
75
81
|
|
|
76
82
|
# Get observations from Madison county, New York
|
|
77
|
-
|
|
83
|
+
country_records = get_observations(api_key, 'US-NY-053')
|
|
78
84
|
|
|
79
85
|
# Get observations from New York
|
|
80
|
-
|
|
86
|
+
state_records = get_observations(api_key, 'US-NY')
|
|
81
87
|
|
|
82
88
|
# Get observations from the USA - don't overdo the data downloads
|
|
83
|
-
|
|
89
|
+
national_records = get_observations(api_key, 'US')
|
|
84
90
|
```
|
|
85
91
|
|
|
86
92
|
Any where you pass in single location or region you can also pass in a
|
|
@@ -88,8 +94,12 @@ list or a comma-separated string. You can specify up to 10 locations or
|
|
|
88
94
|
regions:
|
|
89
95
|
|
|
90
96
|
```python
|
|
97
|
+
import os
|
|
98
|
+
|
|
91
99
|
from ebird.api import get_observations
|
|
92
100
|
|
|
101
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
102
|
+
|
|
93
103
|
# Get the observations for the most visited locations in Madison county, New York:
|
|
94
104
|
# Woodman Pond, Ditch Bank Rd., Cornell Biological Field Station and
|
|
95
105
|
# Anne V Pickard Memorial Wildlife Overlook.
|
|
@@ -101,11 +111,17 @@ counties = 'US-NY-103,US-NY-059,US-NY-81'
|
|
|
101
111
|
records = get_observations(api_key, locations, hotspot=False, category='species')
|
|
102
112
|
```
|
|
103
113
|
|
|
104
|
-
The common name for species can be returned in different languages by
|
|
114
|
+
The common name for species can be returned in different languages by
|
|
115
|
+
specifying locale in the functions that return observations, checklists
|
|
116
|
+
or taxonomy:
|
|
105
117
|
|
|
106
118
|
```python
|
|
119
|
+
import os
|
|
120
|
+
|
|
107
121
|
from ebird.api import get_observations
|
|
108
122
|
|
|
123
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
124
|
+
|
|
109
125
|
records = get_observations(api_key, 'CA-QC', locale='fr')
|
|
110
126
|
```
|
|
111
127
|
|
|
@@ -115,8 +131,12 @@ geographical area - useful for finding the nearest place to see a given
|
|
|
115
131
|
species:
|
|
116
132
|
|
|
117
133
|
```python
|
|
134
|
+
import os
|
|
135
|
+
|
|
118
136
|
from ebird.api import get_nearby_observations
|
|
119
137
|
|
|
138
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
139
|
+
|
|
120
140
|
# Get the most recent sightings of all species seen in the last week within
|
|
121
141
|
# 10km of Point Reyes National Seashore.
|
|
122
142
|
records = get_nearby_observations(api_key, 38.05, -122.94, dist=10, back=7)
|
|
@@ -128,30 +148,42 @@ notable ones (locally or nationally rare species) or limit the records to
|
|
|
128
148
|
a small number of species:
|
|
129
149
|
|
|
130
150
|
```python
|
|
131
|
-
|
|
132
|
-
|
|
151
|
+
import os
|
|
152
|
+
|
|
153
|
+
from ebird.api import (
|
|
154
|
+
get_notable_observations,
|
|
155
|
+
get_nearby_notable,
|
|
156
|
+
get_species_observations,
|
|
157
|
+
get_nearby_species,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
133
161
|
|
|
134
162
|
# Get the interesting birds seen in New York state.
|
|
135
|
-
|
|
163
|
+
notables = get_notable_observations(api_key, 'US-NY')
|
|
136
164
|
|
|
137
165
|
# Get the observations of Horned Lark (Eremophila alpestris) in New York state.
|
|
138
166
|
records = get_species_observations(api_key, 'horlar', 'US-NY')
|
|
139
167
|
|
|
140
168
|
# Get the interesting birds within 50kn of Point Reyes
|
|
141
|
-
|
|
169
|
+
nearby_notables = get_nearby_notable(api_key, 38.05, -122.94, dist=50)
|
|
142
170
|
|
|
143
171
|
# Find out if Barn Swallows have been seen in the area in the past 10 days
|
|
144
|
-
|
|
172
|
+
nearby_species = get_nearby_species(api_key, 'barswa', 38.05, -122.94, back=10)
|
|
145
173
|
```
|
|
146
174
|
|
|
147
175
|
For the more travel-minded you can also find out the nearest place to see a given species:
|
|
148
176
|
|
|
149
177
|
```python
|
|
178
|
+
import os
|
|
179
|
+
|
|
150
180
|
from ebird.api import get_nearest_species
|
|
151
181
|
|
|
182
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
183
|
+
|
|
152
184
|
# Where is the closest place to Cornell Lab of Ornithology to see
|
|
153
185
|
# Tennessee Warbler.
|
|
154
|
-
locations = get_nearest_species('tenwar', 42.48, -76.45)
|
|
186
|
+
locations = get_nearest_species(api_key, 'tenwar', 42.48, -76.45)
|
|
155
187
|
```
|
|
156
188
|
|
|
157
189
|
Depending on what time of year you try this, you might have a long way to go.
|
|
@@ -164,13 +196,17 @@ using get_visits(). Each result returned has the unique identifier for the
|
|
|
164
196
|
checklist. You can then call get_checklist() to get the list of observations.
|
|
165
197
|
|
|
166
198
|
```python
|
|
199
|
+
import os
|
|
200
|
+
|
|
167
201
|
from ebird.api import get_visits, get_checklist
|
|
168
202
|
|
|
203
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
204
|
+
|
|
169
205
|
# Get visits made recently to locations in New York state:
|
|
170
|
-
|
|
206
|
+
visits = get_visits(api_key, 'US-NY')
|
|
171
207
|
|
|
172
208
|
# Get visits made recently to locations in New York state on Jan 1st 2010
|
|
173
|
-
|
|
209
|
+
recent_visits = get_visits(api_key, 'US-NY', '2010-01-01')
|
|
174
210
|
|
|
175
211
|
# Get the details of a checklist
|
|
176
212
|
checklist = get_checklist(api_key, 'S22536787')
|
|
@@ -185,17 +221,18 @@ hotspots within a given radius. get_hotspot() can be used to get information
|
|
|
185
221
|
on the location of a given hotspot.
|
|
186
222
|
|
|
187
223
|
```python
|
|
224
|
+
import os
|
|
225
|
+
|
|
188
226
|
from ebird.api import get_hotspots, get_nearby_hotspots, get_hotspot
|
|
189
227
|
|
|
228
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
229
|
+
|
|
190
230
|
# List all the hotspots in New York state.
|
|
191
231
|
hotspots = get_hotspots(api_key, 'US-NY')
|
|
192
232
|
|
|
193
233
|
# List all the hotspots in New York state visited in the past week.
|
|
194
234
|
recent = get_hotspots(api_key, 'US-NY', back=7)
|
|
195
235
|
|
|
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
236
|
# List all the hotspots in within 50kn of Point Reyes
|
|
200
237
|
nearby = get_nearby_hotspots(api_key, 38.05, -122.94, dist=50)
|
|
201
238
|
|
|
@@ -211,8 +248,12 @@ list of sub-regions for a given region. For the approximate area covered
|
|
|
211
248
|
by a region use get_region().
|
|
212
249
|
|
|
213
250
|
```python
|
|
251
|
+
import os
|
|
252
|
+
|
|
214
253
|
from ebird.api import get_regions, get_adjacent_regions, get_region
|
|
215
254
|
|
|
255
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
256
|
+
|
|
216
257
|
# Get the list of countries in the world.
|
|
217
258
|
countries = get_regions(api_key, 'country', 'world')
|
|
218
259
|
|
|
@@ -238,8 +279,12 @@ e.g. horlar (Horned Lark), cangoo (Canada Goose), etc.,
|
|
|
238
279
|
that are used in the other API calls.
|
|
239
280
|
|
|
240
281
|
```python
|
|
282
|
+
import os
|
|
283
|
+
|
|
241
284
|
from ebird.api import get_taxonomy, get_taxonomy_forms, get_taxonomy_versions
|
|
242
285
|
|
|
286
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
287
|
+
|
|
243
288
|
# Get all the species in the eBird taxonomy.
|
|
244
289
|
taxonomy = get_taxonomy(api_key)
|
|
245
290
|
|
|
@@ -266,9 +311,13 @@ just for a specific day so it is really only useful for "Big Days" when
|
|
|
266
311
|
lots of people are out trying to get the greatest number of species.
|
|
267
312
|
|
|
268
313
|
```python
|
|
314
|
+
import os
|
|
315
|
+
|
|
269
316
|
from datetime import date
|
|
270
317
|
from ebird.api import get_top_100, get_totals
|
|
271
318
|
|
|
319
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
320
|
+
|
|
272
321
|
# Get the winner of the Global Big Day in New York, on 5th May 2018
|
|
273
322
|
winners = get_top_100(api_key, 'US-NY', '2018-05-05')
|
|
274
323
|
|
|
@@ -283,9 +332,11 @@ You can set the API key and locale when creating a Client instance so you don't
|
|
|
283
332
|
have to keep passing them as arguments.
|
|
284
333
|
|
|
285
334
|
```python
|
|
335
|
+
import os
|
|
336
|
+
|
|
286
337
|
from ebird.api import Client
|
|
287
338
|
|
|
288
|
-
api_key =
|
|
339
|
+
api_key = os.environ["EBIRD_API_KEY"]
|
|
289
340
|
locale = 'es'
|
|
290
341
|
|
|
291
342
|
client = Client(api_key, locale)
|
|
@@ -305,7 +356,9 @@ only returns JSON.
|
|
|
305
356
|
|
|
306
357
|
## Compatibility
|
|
307
358
|
|
|
308
|
-
ebird-api works with Python 3.
|
|
359
|
+
ebird-api works with currently supported versions of Python, 3.8+. However,
|
|
360
|
+
it is known to work with earlier versions, at least 3.5 - 3.7, without any
|
|
361
|
+
problems.
|
|
309
362
|
|
|
310
363
|
## Links
|
|
311
364
|
|
ebird_api-3.0.7/MANIFEST.in
DELETED
ebird_api-3.0.7/pyproject.toml
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
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"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|