pyinaturalist.request_params module

Helper functions for processing request parameters

pyinaturalist.request_params.convert_bool_params(params: Dict[str, Any])Dict[str, Any][source]

Convert any boolean request parameters to javascript-style boolean strings

pyinaturalist.request_params.convert_datetime_params(params: Dict[str, Any])Dict[str, Any][source]

Convert any dates, datetimes, or timestamps in other formats into ISO 8601 strings.

API behavior note: params that take date but not time info will accept a full timestamp and just ignore the time, so it’s safe to parse both date and datetime strings into timestamps

Raises

dateutil.parser._parser.ParserError if a date/datetime format is invalid

pyinaturalist.request_params.convert_list_params(params: Dict[str, Any])Dict[str, Any][source]

Convert any list parameters into an API-compatible (comma-delimited) string. Will be url-encoded by requests. For example: [‘k1’, ‘k2’, ‘k3’] -> k1%2Ck2%2Ck3

pyinaturalist.request_params.is_int(value: Any)bool[source]

Determine if a value is a valid integer

pyinaturalist.request_params.merge_two_dicts(x, y)[source]
pyinaturalist.request_params.preprocess_request_params(params: Optional[Dict[str, Any]])Dict[str, Any][source]

Perform type conversions, sanity checks, etc. on request parameters

pyinaturalist.request_params.strip_empty_params(params: Dict[str, Any])Dict[str, Any][source]

Remove any request parameters with empty or None values.