Observations¶
Summary¶
Classes
Functions
|
Create a new observation |
|
Delete an observation |
|
Get observation data, optionally in an alternative format |
|
Update a single observation |
|
Upload a local photo and assign it to an existing observation |
|
Upload a local sound file and assign it to an existing observation |
Module Contents¶
- pyinaturalist.v0.observations.create_observation(**params)¶
Create a new observation
Notes
API reference: POST /observations
- Parameters:
access_token (
Optional
[str
]) – An access token for user authentication, as returned byget_access_token()
species_guess (
Optional
[str
]) – Equivalent to the ‘What did you see?’ field on the observation form. iNat will try to choose a single taxon based on this, but it may fail if it’s ambiguoustaxon_id (
Optional
[int
]) – ID of the taxon to associate with this observationobserved_on (
Union
[date
,datetime
,str
,None
]) – Alias forobserved_on_string
; acceptsdatetime
objects.observed_on_string (
Union
[date
,datetime
,str
,None
]) – Date/time of the observation. Time zone will default to the user’s time zone if not specified.time_zone (
Optional
[str
]) – Time zone the observation was made intag_list (
Union
[str
,Iterable
[str
],None
]) – Comma-separated list of tagsplace_guess (
Optional
[str
]) – Name of the place where the observation was recorded. Note: iNat will not try to automatically look up coordinates based on this stringlatitude (
Optional
[float
]) – Latitude of the observation; presumed datum is WGS84longitude (
Optional
[float
]) – Longitude of the observation; presumed datum is WGS84map_scale (
Optional
[int
]) – Google Maps zoom level (from 0 to 19) at which to show this observation’s map marker.positional_accuracy (
Optional
[int
]) – Positional accuracy of the observation coordinates, in metersobservation_fields (
Union
[Dict
,List
[Dict
],None
]) – Dict of observation fields in the format{id: value}
. Alias forobservation_field_values_attributes
.flickr_photos (
Union
[int
,Iterable
[int
],None
]) – Flickr photo ID(s) to add as photos for this observation. User must have their Flickr and iNat accounts connected, and the user must own the photo(s) on Flickr.picasa_photos (
Union
[str
,Iterable
[str
],None
]) – Picasa photo ID(s) to add as photos for this observation. User must have their Picasa and iNat accounts connected, and the user must own the photo(s) on Picasa.facebook_photos (
Union
[str
,Iterable
[str
],None
]) – Facebook photo IDs to add as photos for this observation. User must have their Facebook and iNat accounts connected, and the user must own the photo on Facebook.photos (
Union
[BinaryIO
,Path
,str
,Iterable
[Union
[BinaryIO
,Path
,str
]],None
]) – One or more image files, file-like objects, file paths, or URLssounds (
Union
[BinaryIO
,Path
,str
,Iterable
[Union
[BinaryIO
,Path
,str
]],None
]) – One or more sound files, file-like objects, file paths, or URLsphoto_ids (
Union
[int
,Iterable
[int
],str
,Iterable
[str
],None
]) – One or more IDs of previously uploaded photos to attach to the observationdry_run (
Optional
[bool
]) – Just log the request instead of sending a real requestsession (
Optional
[Session
]) – An existing Session object to use instead of creating a new one
Example
>>> token = get_access_token() >>> create_observation( >>> access_token=token, >>> species_guess='Pieris rapae', >>> photos='~/observation_photos/2020_09_01_14003156.jpg', >>> observation_fields={297: 1}, # 297 is the obs. field ID for 'Number of individuals' >>> )
[ { "id": 18124406, "observed_on": null, "description": null, "latitude": null, "longitude": null, "map_scale": null, "timeframe": null, "species_guess": "Pieris rapae", "user_id": 1263313, "taxon_id": 55626, "created_at": "2018-11-05T11:08:19.150+01:00", "updated_at": "2018-11-05T11:08:19.215+01:00", "place_guess": null, "id_please": false, "observed_on_string": null, "iconic_taxon_id": 47158, "num_identification_agreements": 0, "num_identification_disagreements": 0, "time_observed_at": null, "time_zone": "Brussels", "location_is_exact": false, "delta": false, "positional_accuracy": null, "private_latitude": null, "private_longitude": null, "private_positional_accuracy": null, "geoprivacy": null, "quality_grade": "casual", "positioning_method": null, "positioning_device": null, "out_of_range": null, "license": "CC-BY-NC", "uri": null, "observation_photos_count": 0, "comments_count": 0, "zic_time_zone": "Europe/Brussels", "oauth_application_id": 278, "observation_sounds_count": 0, "identifications_count": 1, "captive": false, "community_taxon_id": null, "site_id": 1, "old_uuid": null, "public_positional_accuracy": null, "mappable": false, "cached_votes_total": 0, "last_indexed_at": "2018-11-05T02:08:19.652-08:00", "private_place_guess": null, "uuid": "0f0581ce-1be5-4ba5-9d0b-ecac994b50ed", "user_login": "vespawatch", "iconic_taxon_name": "Insecta", "project_observations": [], "created_at_utc": "2018-11-05T10:08:19.150Z", "updated_at_utc": "2018-11-05T10:08:19.215Z", "time_observed_at_utc": null, "faves_count": 0, "owners_identification_from_vision": false } ]
{ "errors": [ [ "Observed on can't be in the future", "Latitude doit être inférieur ou égal à 90" ] ] }
- pyinaturalist.v0.observations.delete_observation(observation_id, **params)¶
Delete an observation
Notes
API reference: DELETE /observations/{id}
- Parameters:
observation_id (
int
) – iNaturalist observation IDaccess_token (
Optional
[str
]) – An access token for user authentication, as returned byget_access_token()
dry_run (
Optional
[bool
]) – Just log the request instead of sending a real requestAn existing Session object to use instead of creating a new one
Example
>>> token = get_access_token() >>> delete_observation(17932425, token)
- Returns:
If successful, no response is returned from this endpoint
- Raises:
.ObservationNotFound – if the requested observation doesn’t exist
HTTPError – 403 if the observation belongs to another user
- pyinaturalist.v0.observations.get_observations(**params)¶
Get observation data, optionally in an alternative format
Notes
API reference: GET /observations
- Parameters:
d1 (
Union
[date
,datetime
,str
,None
]) – Must be observed on or after this dated2 (
Union
[date
,datetime
,str
,None
]) – Must be observed on or before this dateday (
Union
[int
,Iterable
[int
],None
]) – Must be observed within this day of the monthmonth (
Union
[int
,Iterable
[int
],None
]) – Must be observed within this monthyear (
Union
[int
,Iterable
[int
],None
]) – Must be observed within this yearlicense (
Union
[str
,Iterable
[str
],None
]) – Observation must have this licensephoto_license (
Union
[str
,Iterable
[str
],None
]) – Must have at least one photo with this licenseout_of_range (
Optional
[bool
]) – Observations whose taxa are outside their known rangeslist_id (
Optional
[int
]) – Taxon must be in the list with this IDquality_grade (
Optional
[str
]) – Must have this quality gradeid (
Union
[int
,Iterable
[int
],None
]) – Must have this observation IDtaxon_id (
Union
[int
,Iterable
[int
],None
]) – Only show observations of these taxa and their descendantstaxon_name (
Union
[str
,Iterable
[str
],None
]) – Taxon must have a scientific or common name matching this stringiconic_taxa (
Union
[str
,Iterable
[str
],None
]) – Taxon must by within this iconic taxonupdated_since (
Union
[datetime
,str
,None
]) – Must be updated since this timehas (
Union
[str
,Iterable
[str
],None
]) – Catch-all for some boolean selectors. This can be used multiple times, e.g.has=['photos', 'geo']
m1 (
Union
[date
,datetime
,str
,None
]) – First month of a month rangem2 (
Union
[date
,datetime
,str
,None
]) – Last month of a month rangeh1 (
Union
[date
,datetime
,str
,None
]) – First hour of an hour rangeh2 (
Union
[date
,datetime
,str
,None
]) – Last hour of an hour rangeon (
Union
[date
,datetime
,str
,None
]) – Filter by date stringextra (
Optional
[str
]) – Retrieve additional information. ‘projects’ returns info about the projects the observations have been added to, ‘observation_fields’ returns observation field values, ‘observation_photos’ returns information about the photos’ relationship with the observation, like their order.response_format (
str
) – A supported response format to returnper_page (
Optional
[int
]) – Number of results to return in a page. The maximum value is generally 200, unless otherwise notedcount_only (
Optional
[bool
]) – Only return a count of results; alias forper_page=0
reverse (
Optional
[bool
]) – Reverse the order of results; alias fororder='descending'
dry_run (
Optional
[bool
]) – Just log the request instead of sending a real requestAn existing Session object to use instead of creating a new one
Example
>>> get_observations(id=45414404, converters='atom')
<?xml version="1.0" encoding="UTF-8"?> <feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss"> <id>tag:www.inaturalist.org,2005:/observations</id> <link rel="alternate" type="text/html" href="https://www.inaturalist.org"/> <link rel="self" type="application/atom+xml" href="https://www.inaturalist.org/observations.atom?id=16227955"/> <title>iNaturalist: Observations by Everyone</title> <updated>2020-06-10T23:05:37Z</updated> <icon>/assets/favicon-cf3214988200dff386f744b79050b857.png</icon> <entry> <id>tag:www.inaturalist.org,2005:Observation/16227955</id> <published>2018-09-05T12:31:08Z</published> <updated>2018-09-22T17:19:27Z</updated> <link rel="alternate" type="text/html" href="https://www.inaturalist.org/observations/16227955"/> <title>Lixus bardanae</title> <author> <name>niconoe</name> </author> <content type="html"><p><img src="https://static.inaturalist.org/photos/24355313/medium.jpeg?1536150659" alt="Medium" /> <img src="https://static.inaturalist.org/photos/24355315/medium.jpeg?1536150664" alt="Medium" /></p><p></p></content> <georss:point>50.646894 4.360086</georss:point> </entry> </feed>
scientific_name,datetime,description,place_guess,latitude,longitude,tag_list,common_name,url,image_url,user_login,id,species_guess,iconic_taxon_name,taxon_id,num_identification_agreements,num_identification_disagreements,observed_on_string,observed_on,time_observed_at,time_zone,positional_accuracy,private_place_guess,geoprivacy,taxon_geoprivacy,coordinates_obscured,positioning_method,positioning_device,user_id,created_at,updated_at,quality_grade,license,sound_url,oauth_application_id,captive_cultivated Lixus bardanae,2018-09-05 14:06:00 +0200,"",54 rue des Badauds,50.646894,4.360086,"",,https://www.inaturalist.org/observations/16227955,https://static.inaturalist.org/photos/24355315/medium.jpeg?1536150664,niconoe,16227955,Lixus bardanae,Insecta,493595,2,0,2018/09/05 2:06 PM CEST,2018-09-05,2018-09-05 12:06:00 UTC,Paris,23,,,,false,,,886482,2018-09-05 12:31:08 UTC,2018-09-22 17:19:27 UTC,research,CC0,,,false
<?xml version="1.0" encoding="UTF-8"?> <dwr:SimpleDarwinRecordSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://rs.tdwg.org/dwc/xsd/simpledarwincore/ http://rs.tdwg.org/dwc/xsd/tdwg_dwc_simple.xsd" xmlns:ac="http://rs.tdwg.org/ac/terms/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dwc="http://rs.tdwg.org/dwc/terms/" xmlns:dwr="http://rs.tdwg.org/dwc/xsd/simpledarwincore/" xmlns:eol="http://www.eol.org/transfer/content/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://eol.org/schema/media/" xmlns:ref="http://eol.org/schema/reference/" xmlns:xap="http://ns.adobe.com/xap/1.0/"> <dwr:SimpleDarwinRecord> <dwc:occurrenceID>https://www.inaturalist.org/observations/16227955</dwc:occurrenceID> <dwc:occurrenceID>https://www.inaturalist.org/observations/16227955</dwc:occurrenceID> <dwc:basisOfRecord>HumanObservation</dwc:basisOfRecord> <dcterms:modified>2018-09-22T17:19:27Z</dcterms:modified> <dwc:institutionCode>iNaturalist</dwc:institutionCode> <dwc:collectionCode>Observations</dwc:collectionCode> <dwc:datasetName>iNaturalist research-grade observations</dwc:datasetName> <dwc:catalogNumber>16227955</dwc:catalogNumber> <dcterms:references>https://www.inaturalist.org/observations/16227955</dcterms:references> <dwc:occurrenceDetails>https://www.inaturalist.org/observations/16227955</dwc:occurrenceDetails> <dwc:recordedBy>Nicolas Noé</dwc:recordedBy> <dwc:establishmentMeans>wild</dwc:establishmentMeans> <dwc:eventDate>2018-09-05T14:06:00+02:00</dwc:eventDate> <dwc:eventTime>12:06:00Z</dwc:eventTime> <dwc:verbatimEventDate>2018/09/05 2:06 PM CEST</dwc:verbatimEventDate> <dwc:verbatimLocality>54 rue des Badauds</dwc:verbatimLocality> <dwc:decimalLatitude>50.646894</dwc:decimalLatitude> <dwc:decimalLongitude>4.360086</dwc:decimalLongitude> <dwc:coordinateUncertaintyInMeters>23</dwc:coordinateUncertaintyInMeters> <dwc:countryCode>BE</dwc:countryCode> <dwc:stateProvince>Wallonie</dwc:stateProvince> <dwc:identificationID>34896306</dwc:identificationID> <dwc:dateIdentified>2018-09-05T12:34:22Z</dwc:dateIdentified> <dwc:taxonID>493595</dwc:taxonID> <dwc:scientificName>Lixus bardanae</dwc:scientificName> <dwc:taxonRank>species</dwc:taxonRank> <dwc:kingdom>Animalia</dwc:kingdom> <dwc:phylum>Arthropoda</dwc:phylum> <dwc:class>Insecta</dwc:class> <dwc:order>Coleoptera</dwc:order> <dwc:family>Curculionidae</dwc:family> <dwc:genus>Lixus</dwc:genus> <dcterms:license>http://creativecommons.org/publicdomain/zero/1.0/</dcterms:license> <dcterms:rights>By Nicolas Noé no rights reserved</dcterms:rights> <dcterms:rightsHolder>Nicolas Noé</dcterms:rightsHolder> <dwc:inaturalistLogin>niconoe</dwc:inaturalistLogin> <eol:dataObject> <dcterms:identifier>https://www.inaturalist.org/photos/24355313</dcterms:identifier> <dcterms:type>http://purl.org/dc/dcmitype/StillImage</dcterms:type> <dcterms:format>image/jpeg</dcterms:format> <ac:accessURI>https://static.inaturalist.org/photos/24355313/original.jpeg?1536150659</ac:accessURI> <media:thumbnailURL>https://static.inaturalist.org/photos/24355313/thumb.jpeg?1536150659</media:thumbnailURL> <ac:furtherInformationURL>https://www.inaturalist.org/photos/24355313</ac:furtherInformationURL> <ac:derivedFrom>https://www.inaturalist.org/photos/24355313</ac:derivedFrom> <xap:CreateDate>2018-09-05T12:31:01Z</xap:CreateDate> <dcterms:modified>2018-09-05T12:31:01Z</dcterms:modified> <xap:UsageTerms>http://creativecommons.org/licenses/by/4.0/</xap:UsageTerms> <dcterms:rights>Copyright Nicolas Noé, licensed under a Creative Commons Attribution License license: http://creativecommons.org/licenses/by/4.0/</dcterms:rights> <xap:Owner>Nicolas Noé</xap:Owner> <dcterms:publisher>iNaturalist</dcterms:publisher> <dcterms:creator>Nicolas Noé</dcterms:creator> </eol:dataObject> <eol:dataObject> <dcterms:identifier>https://www.inaturalist.org/photos/24355315</dcterms:identifier> <dcterms:type>http://purl.org/dc/dcmitype/StillImage</dcterms:type> <dcterms:format>image/jpeg</dcterms:format> <ac:accessURI>https://static.inaturalist.org/photos/24355315/original.jpeg?1536150664</ac:accessURI> <media:thumbnailURL>https://static.inaturalist.org/photos/24355315/thumb.jpeg?1536150664</media:thumbnailURL> <ac:furtherInformationURL>https://www.inaturalist.org/photos/24355315</ac:furtherInformationURL> <ac:derivedFrom>https://www.inaturalist.org/photos/24355315</ac:derivedFrom> <xap:CreateDate>2018-09-05T12:31:05Z</xap:CreateDate> <dcterms:modified>2018-09-05T12:31:05Z</dcterms:modified> <xap:UsageTerms>http://creativecommons.org/licenses/by/4.0/</xap:UsageTerms> <dcterms:rights>Copyright Nicolas Noé, licensed under a Creative Commons Attribution License license: http://creativecommons.org/licenses/by/4.0/</dcterms:rights> <xap:Owner>Nicolas Noé</xap:Owner> <dcterms:publisher>iNaturalist</dcterms:publisher> <dcterms:creator>Nicolas Noé</dcterms:creator> </eol:dataObject> </dwr:SimpleDarwinRecord> </dwr:SimpleDarwinRecordSet>
[ { "id": 16227955, "observed_on": "2018-09-05", "description": "", "latitude": "50.646894", "longitude": "4.360086", "map_scale": 17, "timeframe": null, "species_guess": "Lixus bardanae", "user_id": 886482, "taxon_id": 493595, "created_at": "2018-09-05T12:31:08.048Z", "updated_at": "2018-09-22T17:19:27.080Z", "place_guess": "54 rue des Badauds", "id_please": false, "observed_on_string": "2018/09/05 2:06 PM CEST", "iconic_taxon_id": 47158, "num_identification_agreements": 2, "num_identification_disagreements": 0, "time_observed_at": "2018-09-05T12:06:00.000Z", "time_zone": "Paris", "location_is_exact": true, "delta": false, "positional_accuracy": 23, "private_latitude": null, "private_longitude": null, "private_positional_accuracy": null, "geoprivacy": null, "quality_grade": "research", "positioning_method": null, "positioning_device": null, "out_of_range": null, "license": "CC0", "uri": "https://www.inaturalist.org/observations/16227955", "observation_photos_count": 2, "comments_count": 2, "zic_time_zone": "Europe/Paris", "oauth_application_id": null, "observation_sounds_count": 0, "identifications_count": 3, "captive": false, "community_taxon_id": 493595, "site_id": 1, "old_uuid": null, "public_positional_accuracy": 23, "mappable": true, "cached_votes_total": 0, "last_indexed_at": "2019-10-10T20:19:39.304Z", "private_place_guess": null, "uuid": "6448d03a-7f9a-4099-86aa-ca09a7740b00", "taxon_geoprivacy": null, "short_description": "", "user_login": "niconoe", "iconic_taxon_name": "Insecta", "tag_list": [], "faves_count": 0, "created_at_utc": "2018-09-05T12:31:08.048Z", "updated_at_utc": "2018-09-22T17:19:27.080Z", "time_observed_at_utc": "2018-09-05T12:06:00.000Z", "owners_identification_from_vision": true, "taxon": { "id": 493595, "name": "Lixus bardanae", "rank": "species", "ancestry": "48460/1/47120/372739/47158/184884/47208/71130/372852/60473/48736/272543/507383/71157", "common_name": null }, "iconic_taxon": { "id": 47158, "name": "Insecta", "rank": "class", "rank_level": 50.0, "ancestry": "48460/1/47120/372739" }, "user": { "login": "niconoe", "user_icon_url": "https://static.inaturalist.org/attachments/users/icons/886482/thumb.jpg?1529671435" }, "photos": [ { "id": 24355313, "user_id": 886482, "native_photo_id": "24355313", "square_url": "https://static.inaturalist.org/photos/24355313/square.jpeg?1536150659", "thumb_url": "https://static.inaturalist.org/photos/24355313/thumb.jpeg?1536150659", "small_url": "https://static.inaturalist.org/photos/24355313/small.jpeg?1536150659", "medium_url": "https://static.inaturalist.org/photos/24355313/medium.jpeg?1536150659", "large_url": "https://static.inaturalist.org/photos/24355313/large.jpeg?1536150659", "created_at": "2018-09-05T12:31:01.946Z", "updated_at": "2018-09-05T12:31:01.946Z", "native_page_url": "https://www.inaturalist.org/photos/24355313", "native_username": "niconoe", "native_realname": "Nicolas No\u00e9", "license": 4, "subtype": null, "native_original_image_url": null, "uuid": "be0dcd96-db21-4c19-814b-bcd33c051ea6", "license_code": "CC-BY", "attribution": "(c) Nicolas No\u00e9, some rights reserved (CC BY)", "license_name": "Creative Commons Attribution License", "license_url": "http://creativecommons.org/licenses/by/4.0/", "type": "LocalPhoto" }, { "id": 24355315, "user_id": 886482, "native_photo_id": "24355315", "square_url": "https://static.inaturalist.org/photos/24355315/square.jpeg?1536150664", "thumb_url": "https://static.inaturalist.org/photos/24355315/thumb.jpeg?1536150664", "small_url": "https://static.inaturalist.org/photos/24355315/small.jpeg?1536150664", "medium_url": "https://static.inaturalist.org/photos/24355315/medium.jpeg?1536150664", "large_url": "https://static.inaturalist.org/photos/24355315/large.jpeg?1536150664", "created_at": "2018-09-05T12:31:05.862Z", "updated_at": "2018-09-05T12:31:05.862Z", "native_page_url": "https://www.inaturalist.org/photos/24355315", "native_username": "niconoe", "native_realname": "Nicolas No\u00e9", "license": 4, "subtype": null, "native_original_image_url": null, "uuid": "154b105a-3e04-448d-b8a3-8ced07af2adf", "license_code": "CC-BY", "attribution": "(c) Nicolas No\u00e9, some rights reserved (CC BY)", "license_name": "Creative Commons Attribution License", "license_url": "http://creativecommons.org/licenses/by/4.0/", "type": "LocalPhoto" } ] } ]
<?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"> <Document> <Placemark id="ID16227955"> <name>Lixus bardanae</name> <visibility>1</visibility> <atom:link>https://www.inaturalist.org/observations/16227955</atom:link> <TimeStamp> <when>2018-09-05T14:06:00+02:00</when> </TimeStamp> <description> <![CDATA[<table cellpadding="5" border="0"> <tr> <td valign="top" style="vertical-align: top"> <a href="https://www.inaturalist.org/observations/16227955"> <img src="https://static.inaturalist.org/photos/24355315/thumb.jpeg?1536150664" alt="Thumb" /> </a> </td> <td valign="top" style="vertical-align: top"> <div> Observed by <a href="https://www.inaturalist.org/observations/niconoe">niconoe</a> <span class="observed_on"><span class="date">2018-09-05</span></span> <span class="place_guess">54 rue des Badauds</span> <br/> <br/> </div> <div> <a class="readmore" href="https://www.inaturalist.org/observations/16227955">View Observation</a> </div> </td> </tr> </table> ]]> </description> <styleUrl>/assets/observations/google_earth-824f44474a896e5afd52c3274499151b.kml?prevent=155#Insecta</styleUrl> <Point> <coordinates>4.360086,50.646894</coordinates> </Point> </Placemark> </Document> </kml>
try { var msg = document.getElementById('inatwidgetmsg'); if (msg) { msg.style.visibility = 'visible'; } document.write('<table data-current-page=\"1\" data-per-page=\"30\" data-total-entries=\"1\"data-total-pages=\"1\"><tr class=\"inat-observation\"><td class=\"inat-observation-image\" valign=\"top\" align=\"center\"><a href=\"https://www.inaturalist.org/observations/16227955\"><img border=\"0\" title=\"Lixus bardanae from 54 rue des Badauds on September 05, 2018 at 02:06 PM by Nicolas Noé\" src=\"https://static.inaturalist.org/photos/24355315/square.jpeg?1536150664\" alt=\"Square\" /><\/a> <\/td><td class=\"inat-observation-body\" valign=\"top\"><a href=\"https://www.inaturalist.org/observations/16227955\">Lixus bardanae<\/a><div class=\"inat-meta\"><span class=\"inat-label\">Observer: <\/span><span class=\"inat-value\"><a href=\"https://www.inaturalist.org/observations/niconoe\">niconoe<\/a><\/span><br/><span class=\"inat-label\">Date: <\/span><span class=\"inat-value\"> Sep 05 2018<\/span><br/><span class=\"inat-label\">Place: <\/span><span class=\"inat-value\">54 rue des Badauds<\/span><\/div><\/td><\/tr><\/table>') } catch (e) {}
- pyinaturalist.v0.observations.update_observation(observation_id, **params)¶
Update a single observation
Notes
API reference: PUT /observations/{id}
Note
Unlike the underlying REST API endpoint, this function will not delete any existing photos from your observation if not specified in
local_photos
. If you want this to behave the same as the REST API and you do want to delete photos, call withignore_photos=False
.- Parameters:
observation_id (
int
) – iNaturalist observation IDaccess_token (
Optional
[str
]) – An access token for user authentication, as returned byget_access_token()
species_guess (
Optional
[str
]) – Equivalent to the ‘What did you see?’ field on the observation form. iNat will try to choose a single taxon based on this, but it may fail if it’s ambiguoustaxon_id (
Optional
[int
]) – ID of the taxon to associate with this observationobserved_on (
Union
[date
,datetime
,str
,None
]) – Alias forobserved_on_string
; acceptsdatetime
objects.observed_on_string (
Union
[date
,datetime
,str
,None
]) – Date/time of the observation. Time zone will default to the user’s time zone if not specified.time_zone (
Optional
[str
]) – Time zone the observation was made intag_list (
Union
[str
,Iterable
[str
],None
]) – Comma-separated list of tagsplace_guess (
Optional
[str
]) – Name of the place where the observation was recorded. Note: iNat will not try to automatically look up coordinates based on this stringlatitude (
Optional
[float
]) – Latitude of the observation; presumed datum is WGS84longitude (
Optional
[float
]) – Longitude of the observation; presumed datum is WGS84map_scale (
Optional
[int
]) – Google Maps zoom level (from 0 to 19) at which to show this observation’s map marker.positional_accuracy (
Optional
[int
]) – Positional accuracy of the observation coordinates, in metersobservation_fields (
Union
[Dict
,List
[Dict
],None
]) – Dict of observation fields in the format{id: value}
. Alias forobservation_field_values_attributes
.flickr_photos (
Union
[int
,Iterable
[int
],None
]) – Flickr photo ID(s) to add as photos for this observation. User must have their Flickr and iNat accounts connected, and the user must own the photo(s) on Flickr.picasa_photos (
Union
[str
,Iterable
[str
],None
]) – Picasa photo ID(s) to add as photos for this observation. User must have their Picasa and iNat accounts connected, and the user must own the photo(s) on Picasa.facebook_photos (
Union
[str
,Iterable
[str
],None
]) – Facebook photo IDs to add as photos for this observation. User must have their Facebook and iNat accounts connected, and the user must own the photo on Facebook.photos (
Union
[BinaryIO
,Path
,str
,Iterable
[Union
[BinaryIO
,Path
,str
]],None
]) – One or more image files, file-like objects, file paths, or URLssounds (
Union
[BinaryIO
,Path
,str
,Iterable
[Union
[BinaryIO
,Path
,str
]],None
]) – One or more sound files, file-like objects, file paths, or URLsphoto_ids (
Union
[int
,Iterable
[int
],str
,Iterable
[str
],None
]) – One or more IDs of previously uploaded photos to attach to the observationignore_photos (
bool
) – If photos exist on the observation but are missing in the request, ignore them instead of deleting the missing observation photosdry_run (
Optional
[bool
]) – Just log the request instead of sending a real requestAn existing Session object to use instead of creating a new one
Example
>>> token = get_access_token() >>> update_observation( >>> 17932425, >>> access_token=token, >>> description='updated description!', >>> )
[ { "id": 17932425, "observed_on": "2018-10-29", "description": "updated description v2 !", "latitude": "50.4898053873", "longitude": "5.1035889611", "map_scale": null, "timeframe": null, "species_guess": null, "user_id": 1263313, "taxon_id": 54327, "created_at": "2018-10-29T14:37:32.176+01:00", "updated_at": "2018-10-30T14:30:11.667+01:00", "place_guess": "Namur, Wallonie, BE", "id_please": false, "observed_on_string": "2018-10-28T23:00:00+00:00", "iconic_taxon_id": 47158, "num_identification_agreements": 0, "num_identification_disagreements": 0, "time_observed_at": "2018-10-29T00:00:00.000+01:00", "time_zone": "Brussels", "location_is_exact": false, "delta": false, "positional_accuracy": null, "private_latitude": null, "private_longitude": null, "private_positional_accuracy": null, "geoprivacy": null, "quality_grade": "casual", "positioning_method": null, "positioning_device": null, "out_of_range": null, "license": "CC-BY-NC", "uri": "https://www.inaturalist.org/observations/17932425", "observation_photos_count": 0, "comments_count": 0, "zic_time_zone": "Europe/Brussels", "oauth_application_id": 278, "observation_sounds_count": 0, "identifications_count": 1, "captive": false, "community_taxon_id": null, "site_id": 1, "old_uuid": null, "public_positional_accuracy": null, "mappable": true, "cached_votes_total": 0, "last_indexed_at": "2018-10-30T06:36:06.027-07:00", "private_place_guess": null, "uuid": "03d9e7a4-d96e-4de0-a9ec-d1dacc14be44", "user_login": "vespawatch", "iconic_taxon_name": "Insecta", "created_at_utc": "2018-10-29T13:37:32.176Z", "updated_at_utc": "2018-10-30T13:30:11.667Z", "time_observed_at_utc": "2018-10-28T23:00:00.000Z", "faves_count": 0, "owners_identification_from_vision": false } ]
- pyinaturalist.v0.observations.upload_photos(observation_id, photos, **params)¶
Upload a local photo and assign it to an existing observation
Notes
API reference: POST /observation_photos
Example
>>> token = get_access_token() >>> upload_photos(1234, '~/observations/2020_09_01_14003156.jpg', access_token=token)
Multiple photos can be uploaded at once:
>>> upload_photos( >>> 1234, >>> ['~/observations/2020_09_01_14003156.jpg', '~/observations/2020_09_01_14004223.jpg'], >>> access_token=token, >>> )
[ { "id": 1234, "observation_id": 1234, "photo_id": 1234, "position": null, "created_at": "2020-09-24T21:06:16.964-05:00", "updated_at": "2020-09-24T21:06:16.964-05:00", "old_uuid": null, "uuid": "f4ec883f-e835-4590-ab3e-97900bd454a5", "created_at_utc": "2020-09-25T02:06:16.964Z", "updated_at_utc": "2020-09-25T02:06:16.964Z", "photo": { "id": 1234, "user_id": 1234, "native_photo_id": "1234", "square_url": null, "thumb_url": null, "small_url": null, "medium_url": null, "large_url": null, "created_at": "2020-09-24T21:06:15.212-05:00", "updated_at": "2020-09-24T21:06:15.212-05:00", "native_page_url": null, "native_username": "username", "native_realname": "Firstname Lastname", "license": 2, "subtype": null, "native_original_image_url": null, "uuid": "632dddc1-85ad-4664-8438-de6e0afd7746", "license_name": "Creative Commons Attribution-NonCommercial License", "license_url": "http://creativecommons.org/licenses/by-nc/4.0/", "attribution": "(c) Firstname Lastname, some rights reserved (CC BY-NC)", "type": "LocalPhoto" } } ]
- pyinaturalist.v0.observations.upload_sounds(observation_id, sounds, **params)¶
Upload a local sound file and assign it to an existing observation
Notes
Example
>>> token = get_access_token() >>> upload_sounds(1234, '~/observations/2020_09_01_14003156.mp3', access_token=token)
[ { "id": 233946, "uuid": "d77d4725-5498-4145-8e2b-6e6580df88c6", "created_at": "2021-05-30T17:36:40.286-05:00", "updated_at": "2021-05-30T17:36:40.286-05:00", "sound": { "id": 239936, "license_code": "cc-by-nc", "attribution": "(c) Jordan Cook, some rights reserved (CC BY-NC)", "native_sound_id": null, "secret_token": null, "file_url": "https://static.inaturalist.org/sounds/239936.mp3?1622414199", "file_content_type": "audio/mpeg", "play_local": true, "subtype": null, "flags": [] } } ]
Multiple sounds can be uploaded at once:
>>> upload_sounds( >>> 1234, >>> ['~/observations/2020_09_01_14003156.mp3', '~/observations/2020_09_01_14004223.wav'], >>> access_token=token, >>> )