Observations#

class pyinaturalist.models.Observations(id=None, uuid=None, data=_Nothing.NOTHING)#

Bases: BaseModelCollection

A collection of observations

Attributes

Name

Type

Description

id

int

Unique record ID

uuid

str

Unversally unique record ID

data

List[Observation]

identifiers (property)

List[User]

Get all unique identifiers

observers (property)

List[User]

Get all unique observers

photos (property)

List[Photo]

Get default photo for each observation

taxa (property)

List[Taxon]

Get all unique taxa

Methods

__init__(id=None, uuid=None, data=_Nothing.NOTHING)#

Method generated by attrs for class Observations.

append(item)#

S.append(value) – append value to the end of the sequence

clear() None -- remove all items from S#
classmethod copy(obj)#

Copy a model collection

count(value) integer -- return number of occurrences of value#
deduplicate()#

Remove any duplicates from this collection based on ID

extend(other)#

S.extend(iterable) – extend sequence by appending elements from the iterable

classmethod from_json(value, **kwargs)#

Initialize a single model object from an API response or response result.

Omits any invalid fields and None values, so default factories are used instead (e.g. for empty dicts and lists).

Return type:

TypeVar(TC, bound= BaseModelCollection)

classmethod from_json_file(value)#

Initialize a collection of model objects from a JSON string, file path, or file-like object

Return type:

List[TypeVar(T, bound= BaseModel)]

classmethod from_json_list(value, **kwargs)#

For model collections, initializing from a list should return an instance of cls instead of a builtin list

Return type:

TypeVar(TC, bound= BaseModelCollection)

get_count(id, count_field='count')#

Get a count associated with the given ID. Returns 0 if the collection type is not countable or the ID doesn’t exist.

Return type:

int

index(value[, start[, stop]]) integer -- return first index of value.#

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

insert(i, item)#

S.insert(index, value) – insert value before index

pop([index]) item -- remove and return item at index (default last).#

Raise IndexError if list is empty or index is out of range.

remove(item)#

S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.

reverse()#

S.reverse() – reverse IN PLACE

sort(*args, **kwds)#
to_dict(keys=None, recurse=True)#

Convert this object back to dict format

Parameters:
  • keys (Optional[List[str]]) – Only keep the specified keys (attribute names)

  • recurse (bool) – Recurse into nested model objects

Return type:

Dict[str, Any]