pyinaturalist.v1.observation_fields

Summary

delete_observation_field(…)

Delete an observation field value from an observation

set_observation_field(observation_id, …)

Create or update an observation field value on an observation

Module Contents

pyinaturalist.v1.observation_fields.delete_observation_field(observation_field_value_id, **params)

Delete an observation field value from an observation

Notes

Example

>>> # Observation field value IDs can be found on observation records:
>>> response = get_observation(70963477)
>>> ofv_ids = [ofv['id'] for ofv in response['ofvs']]
>>> for ofv_id in ofv_ids:
...     delete_observation_field(ofv_id)
Parameters
  • observation_field_value_id (Union[int, str]) – ID or UUID of the observation field value to delete

  • access_token – An access token required for user authentication, as returned by get_access_token()

Return type

Dict[str, Any]

pyinaturalist.v1.observation_fields.set_observation_field(observation_id, observation_field_id, value, **params)

Create or update an observation field value on an observation

Notes

Parameters
  • observation_id (int) – ID of the observation receiving this observation field value

  • observation_field_id (int) – ID of the observation field for this observation field value

  • value (Any) – Value for the observation field

  • access_token (Optional[str]) – An access token required for user authentication, as returned by get_access_token()

  • dry_run (bool) – Just log the request instead of sending a real request

  • session (Optional[Session]) – An existing Session object to use instead of creating a new one

  • user_agent (Optional[str]) – A custom user-agent string to provide to the iNaturalist API

Example

>>> # First find an observation field by name, if the ID is unknown:
>>> response = get_observation_fields('vespawatch_id')
>>> observation_field_id = response[0]['id']
>>> set_observation_field(
...     7345179,
...     observation_field_id,
...     value=250,
...     access_token=token,
... )

Example Response

Return type

Dict[str, Any]

Returns

The newly updated field value record