Comments (6)
Good catch! After looking over the API docs some more, it looks like this applies to all boolean parameters. For example:
# Returns 1 result (not expected):
get_observations({'id':43039160, 'taxon_is_active': False})
# Returns 0 results (expected):
get_observations({'id':43039160, 'taxon_is_active': 'false'})
I think this would be simple enough to address by applying some more param processing in make_inaturalist_api_get_call()
, for example:
def convert_bool_params(params):
for k, v in params.items():
if isinstance(v, bool):
params[k] = str(v).lower()
return params
I'm also going to look through the API docs some more to see if there are any other request parameter types that might need special handling.
from pyinaturalist.
Looks like we have the following parameter types in the Node API:
Array[integrer]
Array[string]
boolean
date
date-time
double
file
integer
string
Arrays should already be handled by concat_list_params()
. I can submit a PR for booleans.
from pyinaturalist.
EDIT: Moved comments on datetimes to Issue #18
from pyinaturalist.
Thanks for the great PR, @JWCook! That's now merged.
I just keep this issue open so I remember to add an additional "high level" test to ensure that the new conversion functions are actually called from the various user-callable functions (I know they are, it's just for the future). For example:
- test that
get_taxa(q='Lixus bardanae', is_active=False)
(the first example at the top of this issue) gives the expected result. - also test your other fix (for integer lists) is applied from those methods.
from pyinaturalist.
@niconoe I just added some more tests to PR #20 (see this commit), since that also involves request param conversion.
That adds both of your example test cases, as well as a test that dynamically gets all functions named pyinaturalist.node_api.get_*
(so it will also apply to GET
endpoints added in the future), and ensures that they all covert parameters.
Once that and the updates to docs are merged in, I plan to finish dry-run mode for Issue #9 (which is mostly done except for unit tests), update the rest_api
endpoints with these changes, and then add a couple more endpoints.
from pyinaturalist.
I am moving those tests and other related updates to the rest_api
module to a separate PR, #22, which is almost done.
from pyinaturalist.
Related Issues (20)
- Fix type annotations in API docs HOT 1
- Add lifelist metadata to response in ObservationController.life_list()
- ImportError: cannot import name 'RequestRate' from 'pyrate_limiter' HOT 3
- Put long param sections in dropdowns
- AnnotationController.create() - allow adding annotations by label instead of ID
- Drop support for python 3.7
- binder down? HOT 2
- possible issue with some endpoints HOT 7
- TimeoutError: The write operation timed out HOT 12
- Using Dry Run throws a key error HOT 2
- Adding 'Notes' to observations HOT 2
- A big shoutout! HOT 5
- Checking if the token provided is valid HOT 3
- Observations to/from Pandas DataFrame HOT 5
- GUANOMetadata Support in Audio files HOT 4
- Create/update observations with Observation objects
- Error `WARNING Parameters missing or invalid:1/1 cannot come before 1/1"` using pyinaturalist HOT 5
- HTTP 429 Rate Limit error on reading observations HOT 3
- Feature request: support for font-awesome icons inplace of emojis for user interface HOT 2
- No results for request using pyinaturalist HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyinaturalist.