Querying the API via python returns 500 error

++SOLVED++

For the past few weeks I have been successfully querying the API via python to obtain data about my observations.
This morning when I attempt it, I get the error:
‘error’: ‘Elasticsearch error, if this persists please contact the iNaturalist development team.’, ‘status’: 500

When querying:
base_url = “https://api.inaturalist.org/v1/observations
params = {“user_id”: user_id, “per_page”: 2, “page”: page, “nelat”: 49.99284107845855, “nelng”: -121.48133782669902, “swlat”:47.23367173462317, “swlng”: -123.76649407669902} # Adjust per_page as needed
response = requests.get(base_url, params=params)
print(response)

If I got to the site https://api.inaturalist.org/v1/observations, it does not seem to be down however. The code worked yesterday, the only changes I am aware of making were installing the pip package pyinaturalist and a few dependencies, so I don’t think the issue should be on my end, though it is possible

1 Like

Can you please include the full URL that is giving a 500 error? I’d double check your parameters including the page parameter. Looks like it might be set to 0. If that’s the case we can maybe catch the error with a nicer error message saying invalid page parameter value

1 Like

It is indeed the fault of the page. I don’t remember changing the pages I looped over, but I must have. Page 0 is what returns the error

1 Like