Page 1 of 1

Inasaturalistische API - Fehlende Beobachtungsnamen als Antwort?

Posted: 31 Jan 2025, 12:19
by Guest
`Hallo
Ich wollte sehen, ob jemand hier Erfahrung mit der inasaturalistischen API hat, weil ich ein Problem damit habe. Ich habe eine Webseite mit Python erstellt, aber ich bin mir nicht sicher, ob ich die Anfrage falsch mache oder ob es ein anderes Problem gibt. fehlt den Namen der Beobachtung (wissenschaftlicher Name). Ich verstehe nicht wirklich, warum das passiert. So mache ich die Anfrage: `
` `< /p>

Code: Select all

import requests

url = "https://api.inaturalist.org/v1/observations"
params = {
"taxon_name": "Plantae",
"lat": 40.7128,  # Example latitude
"lng": -74.0060,  # Example longitude
"radius": 10,  # Search radius in km
"per_page": 50,
"order_by": "observed_on"
}

response = requests.get(url, params=params)
data = response.json()

for obs in data.get("results", []):
taxon = obs.get("taxon", {})
scientific_name = taxon.get("name", "Unknown")
print(f"Scientific Name: {scientific_name}")
`Sometimes I get correct scientific names, but in most cases, the "name" field is missing. I’m wondering if I need to change something in my request or if the API just doesn’t always return this data.
< /code>
`

Has anyone encountered this issue before? Any advice would be greatly appreciated! Thanks in advance!`